setState method

void setState(
  1. VoidCallback fn
)

Marks this state as dirty and schedules a rebuild.

  • Executes the given callback fn to mutate the state.
  • Triggers the owning instance and the app to rebuild.

Implementation

void setState(VoidCallback fn) {
  fn();
  instance.rebuild();
  AppInstance.instance.requestRebuild();
}