Back to articles
DuitDataSource: The Data Layer That Quietly Changed Everything in Duit

DuitDataSource: The Data Layer That Quietly Changed Everything in Duit

via Dev.toNikita Sin

1000 widget update iterations: about 1.9 seconds with the old attribute-based approach, 114 ms with the newer one. That gap is the reason this article exists. In Duit, widget updates used to revolve around attribute classes: parse JSON into Dart objects, create new attribute instances for every update, then merge old and new state to produce the final result. It was structured. It was explicit. In a hot path, especially during animations, it was also too expensive. Each update meant more parsing, more copying, more object allocation, and more boilerplate than the framework was getting back in value. In the most expensive scenarios, that translated into more GC pressure and slower frame preparation. The improvement did not come from one clever micro-optimization. It came from changing the role of data in the framework. This article explains why DuitDataSource is not just a typed wrapper around Map<String, dynamic> , but the runtime layer that now handles parsing, partial updates, memoiz

Continue reading on Dev.to

Opens in a new tab

Read Full Article
7 views

Related Articles