schedule method

  1. @override
bool schedule()
override

Schedules this effect to run at the end of the current Flutter frame.

This method implements the EffectScheduler interface, allowing custom scheduling behavior. Multiple calls within the same frame will only result in a single execution at frame end (batch processing).

Returns: true to indicate custom scheduling was handled

Implementation

@override
bool schedule() {
  // If already scheduled for this frame, skip
  if (_isScheduled) {
    return true;
  }

  // Mark as scheduled
  _isScheduled = true;

  // Schedule for end of frame
  SchedulerBinding.instance.endOfFrame.then((_) {
    _isScheduled = false;
    _executeEffect();
  });

  return true;
}