ensureInitialized method Null safety

RendererBinding ensureInitialized()

Returns an instance of the binding that implements RendererBinding. If no binding has yet been initialized, the RenderingFlutterBinding class is used to create and initialize one.

You need to call this method before using the rendering framework if you are using it directly. If you are using the widgets framework, see WidgetsFlutterBinding.ensureInitialized.

Implementation

static RendererBinding ensureInitialized() {
  if (RendererBinding._instance == null)
    RenderingFlutterBinding();
  return RendererBinding.instance;
}