getAsync<C extends IController> static method

Future<C> getAsync<C extends IController>(
  1. BuildContext context
)

Implementation

static Future<C> getAsync<C extends IController>(BuildContext context) {
  final completer = Completer<C>();
  WidgetsBinding.instance.addPostFrameCallback((_) async {
    completer.complete(LocatorProvider.of(context).get<C>());
  });

  return completer.future;
}