captureAll method Null safety

Widget captureAll(
  1. BuildContext context,
  2. Widget child,
  3. {BuildContext? to}
)

Returns a widget that will wrap child in all of the inherited themes which are present between context and the specified to BuildContext.

The to context must be an ancestor of context. If to is not specified, all inherited themes up to the root of the widget tree are captured.

After calling this method, the themes present between context and to are frozen for the provided child. If the themes (or their theme data) change in the original subtree, those changes will not be visible to the wrapped child - unless this method is called again to re-wrap the child.

Implementation

static Widget captureAll(BuildContext context, Widget child, {BuildContext? to}) {
  assert(child != null);
  assert(context != null);

  return capture(from: context, to: to).wrap(child);
}