markNeedsBuild method

  1. @override
void markNeedsBuild()
override

Cause this entry to rebuild during the next pipeline flush.

You need to call this function if the output of builder has changed.

Implementation

@override
void markNeedsBuild() {
  // Special handling to avoid rebuilds during persistent callbacks phase
  if (SchedulerBinding.instance.schedulerPhase == SchedulerPhase.persistentCallbacks) {
    // Schedule rebuild after current frame if in persistent callback phase
    SchedulerBinding.instance.addPostFrameCallback((_) {
      super.markNeedsBuild();
    });
  } else {
    // Normal rebuild for other phases
    super.markNeedsBuild();
  }
}