markNeedsAddToScene method Null safety

  1. @protected
  2. @visibleForTesting
void markNeedsAddToScene()
protected">@protectedvisibleForTesting">@visibleForTesting

Mark that this layer has changed and addToScene needs to be called.

Implementation

@protected
@visibleForTesting
void markNeedsAddToScene() {
  assert(!_debugMutationsLocked);
  assert(
    !alwaysNeedsAddToScene,
    '$runtimeType with alwaysNeedsAddToScene set called markNeedsAddToScene.\n'
    "The layer's alwaysNeedsAddToScene is set to true, and therefore it should not call markNeedsAddToScene.",
  );
  assert(!_debugDisposed);

  // Already marked. Short-circuit.
  if (_needsAddToScene) {
    return;
  }

  _needsAddToScene = true;
}