visitChildElements method Null safety

  1. @override
void visitChildElements(
  1. ElementVisitor visitor
)
override

Wrapper around visitChildren for BuildContext.

Implementation

@override
void visitChildElements(ElementVisitor visitor) {
  assert(() {
    if (owner == null || !owner!._debugStateLocked) {
      return true;
    }
    throw FlutterError.fromParts(<DiagnosticsNode>[
      ErrorSummary('visitChildElements() called during build.'),
      ErrorDescription(
        "The BuildContext.visitChildElements() method can't be called during "
        'build because the child list is still being updated at that point, '
        'so the children might not be constructed yet, or might be old children '
        'that are going to be replaced.',
      ),
    ]);
  }());
  visitChildren(visitor);
}