Loading topic
build on every change. Before you can shrink rebuilds, you need an accurate picture of what triggers one and what a rebuild costs. This chapter builds that model. Later chapters use it to measure and reduce rebuilds.5 min readStatefulWidget, you know what setState does, and you can run an app on a device or emulator. You should also know that build can run man6 min readStatefulWidget, you have called setState many times, and you can run an app in debug mode. Earlier chapters covered why widgets rebuild and how to measure rebuilds. This chapter covers the first fix, which is to keep state as low in the tree as it can go.6 min readsetState marks an element dirty and calls build (covered earlier in this tutorial), and that you can run a Flutter app in debug mode. By the end you will be able to:7 min readStatelessWidget and StatefulWidget, how setState triggers build, and what const constructors do. The earlier chapters on `6 min readsetState and build work, can read basic Dart, and have seen the earlier chapters on limiting setState scope and using const widgets. Here you will learn how the child parameter of builder widgets lets you keep a static subtree out of a rebuild, even when t7 min readsetState. It also assumes you know that build runs again whenever a widget is marked dirty. Earlier chapters covered how rebuilds happen, how to measure them, and how to push setState down into small widgets. This chapter cover5 min readStatelessWidget and StatefulWidget classes, you know what setState does, and you have seen ChangeNotifier or ValueNotifier before. It builds on the previous chapter, where ValueListenableBuilder rebuilt only the part of the tree that listens to one valu5 min readsetState marks an element dirty and how build runs again, which earlier chapters covered. It also assumes you have used MediaQuery.of and Theme.of, and that you can profile a Flutter app in profile mode.5 min readStatelessWidget and StatefulWidget, and setState. It also assumes you have read how rebuilds are triggered. The earlier chapters narrowed which widgets rebuild. This one makes each build call cheap, because some rebuilds can't be avoided.5 min readsetState marks elements dirty, how to measure rebuilds, and how to narrow rebuild scope. It also assumes you can run an app in profile mode. The previous chapters cut the cost of the build phase. This chapter covers the next phase, pai6 min readStatefulWidget code, know what setState does, and can run an app in profile mode on a real device. It also assumes you have seen the individual tools from earlier chapter8 min read