wrapWithDefaultView method

  1. @override
Widget wrapWithDefaultView(
  1. Widget rootWidget
)
override

Used by runApp to wrap the provided rootWidget in the default View.

The View determines into what FlutterView the app is rendered into. This is currently PlatformDispatcher.implicitView from platformDispatcher. This method will throw a StateError if the PlatformDispatcher.implicitView is null.

The rootWidget widget provided to this method must not already be wrapped in a View.

Implementation

@override
Widget wrapWithDefaultView(Widget rootWidget) {
  // This is a workaround where screenshots of root widgets have incorrect
  // bounds.
  // TODO(jiahaog): Remove when https://github.com/flutter/flutter/issues/66006 is fixed.
  return super.wrapWithDefaultView(RepaintBoundary(child: rootWidget));
}