rebuild method

Future<void> rebuild()

Implementation

Future<void> rebuild() async {
  if (!mounted) return;

  // if there's a current frame,
  if (SchedulerBinding.instance?.schedulerPhase != SchedulerPhase.idle) {
    // wait for the end of that frame.
    await SchedulerBinding.instance?.endOfFrame;
    if (!mounted) return;
  }

  setState(() {});
}