void scheduleBuildFor(BuildableElement element)

Adds an element to the dirty elements list so that it will be rebuilt when WidgetsBinding.beginFrame calls buildScope.

Source

void scheduleBuildFor(BuildableElement element) {
  assert(element != null);
  assert(element.owner == this);
  assert(element._inDirtyList == _dirtyElements.contains(element));
  assert(() {
    if (debugPrintScheduleBuildForStacks)
      debugPrintStack(label: 'scheduleBuildFor() called for $element${_dirtyElements.contains(element) ? " (ALREADY IN LIST)" : ""}');
    if (element._inDirtyList) {
      throw new FlutterError(
        'scheduleBuildFor() called for a widget for which a build was already scheduled.\n'
        'The method was called for the following element:\n'
        '  $element\n'
        'The current dirty list consists of:\n'
        '  $_dirtyElements\n'
        'This usually indicates that a widget was rebuilt outside the build phase (thus '
        'marking the element as clean even though it is still in the dirty list). '
        'This should not be possible and is probably caused by a bug in the widgets framework. '
        'Please report it: https://github.com/flutter/flutter/issues/new\n'
        'To debug this issue, consider setting the debugPrintScheduleBuildForStacks and '
        'debugPrintBuildDirtyElements flags to true and looking for a call to scheduleBuildFor '
        'for a widget that is labeled "ALREADY IN LIST".'
      );
    }
    if (!element.dirty) {
      throw new FlutterError(
        'scheduleBuildFor() called for a widget that is not marked as dirty.\n'
        'The method was called for the following element:\n'
        '  $element\n'
        'This element is not current marked as dirty. Make sure to set the dirty flag before '
        'calling scheduleBuildFor().\n'
        'If you did not attempt to call scheduleBuildFor() yourself, then this probably '
        'indicates a bug in the widgets framework. Please report it: '
        'https://github.com/flutter/flutter/issues/new'
      );
    }
    return true;
  });
  if (!_scheduledFlushDirtyElements && onBuildScheduled != null) {
    _scheduledFlushDirtyElements = true;
    onBuildScheduled();
  }
  _dirtyElements.add(element);
  element._inDirtyList = true;
  assert(() {
    if (debugPrintScheduleBuildForStacks)
      debugPrint('...dirty list is now: $_dirtyElements');
    return true;
  });
}