markMayNeedRebuild method

void markMayNeedRebuild()

Mark the associated HookWidget as potentially needing to rebuild.

As opposed to setState, the rebuild is optional and can be cancelled right before build is called, by having shouldRebuild return false.

Implementation

void markMayNeedRebuild() {
  if (_element!._isOptionalRebuild != false) {
    _element!
      .._isOptionalRebuild = true
      .._shouldRebuildQueue.add(_Entry(shouldRebuild))
      ..markNeedsBuild();
  }
  assert(_element!.dirty, 'Bad state');
}