ensureInitialized method Null safety

AutomatedTestWidgetsFlutterBinding ensureInitialized()
override

Returns an instance of the binding that implements AutomatedTestWidgetsFlutterBinding. If no binding has yet been initialized, the a new instance is created.

Generally, there is no need to call this method. Use TestWidgetsFlutterBinding.ensureInitialized instead, as it will select the correct test binding implementation automatically.

Implementation

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