ensureInitialized static method
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 WidgetsBinding ensureInitialized() {
if (!_initialized) {
_initialized = true;
TrackingBuildOwnerAutomatedTestWidgetsFlutterBinding();
}
assert(WidgetsBinding.instance
is TrackingBuildOwnerAutomatedTestWidgetsFlutterBinding);
return WidgetsBinding.instance;
}