[Breaking Change] runApp builds root widget asynchronously via timer

Skip to first unread message

Chun-Heng Tai

Aug 28, 2019, 7:11:52 PM8/28/19
to flutter-...@googlegroups.com

If you are NOT relying on runApp to build widget tree synchronously or inserting Timer/Microtask during runApp, you can stop reading now.


runApp builds root widget by calling attachRootWidget and schedule a warm up frame. Sometimes, the platform might flush user setting to dirty the widget tree before the scheduled warm up frame is drawn. This will cause the widget tree to rebuild again when drawing warm up frame.


Ideally, we should only need to build widget tree once before warm up frame is drawn. The proposal is to make sure we do not allow interference in the between attachRootWidget and warm up frame. If something does need to dirty the widget tree, it should happen either before attachRootWidget or after warm up frame is drawn.


For a more detailed explanation of this issue please check the description in this PR


Related Issues



How to migrate

If you would like to schedule Timer during runApp, there are two cases you would want to consider. If it requires widget tree to be built, you can schedule a Timer after the runApp.

If it does not require widget tree to be built, you can schedule a MicroTask or Timer before runApp is called.


Feel free to leave feedback on the PR or issue if you have any questions. I am more than happy to address any concerns.




Reply all
Reply to author
0 new messages