MultiChildRenderObjectWidget constructor Null safety

MultiChildRenderObjectWidget(
  1. {Key? key,
  2. List<Widget> children = const <Widget>[]}
)

Initializes fields for subclasses.

The children argument must not be null and must not contain any null objects.

Implementation

MultiChildRenderObjectWidget({ super.key, this.children = const <Widget>[] })
  : assert(children != null) {
  assert(() {
    for (int index = 0; index < children.length; index++) {
      // TODO(a14n): remove this check to have a lot more const widget
      if (children[index] == null) {
        throw FlutterError(
          "$runtimeType's children must not contain any null values, "
          'but a null value was found at index $index',
        );
      }
    }
    return true;
  }()); // https://github.com/dart-lang/sdk/issues/29276
}