setState method

void setState(
  1. void fn()
)

setState: mutate internal state then ask element to rebuild.

Implementation

void setState(void Function() fn) {
  fn();
  // trigger a rebuild on the element (which will call state.build())
  element.rebuild();
}