buildWithChild method
A build method that receives an extra child
parameter.
This method may be called with a child
different from the parameter
passed to the constructor of SingleChildStatelessComponent.
It may also be called again with a different child
, without this component
being recreated.
Implementation
@override
Iterable<Component> buildWithChild(
BuildContext context, Component? child) sync* {
final builder = this.builder;
assert(
builder != null || child != null,
'$runtimeType used outside of MultiProvider must specify a child',
);
yield _InheritedProviderScope<T?>(
owner: this,
// ignore: no_runtimetype_tostring
debugType: kDebugMode ? '$runtimeType' : '',
child: builder != null
? Builder(
builder: (context) => builder(context, child),
)
: child!,
);
}