of<T extends MomentumController> static method
- @Deprecated('Use `Momentum.controller<T>(context)` instead')
- BuildContext context
The static method for getting controllers inside a widget.
NOTE: This will be removed in the future.
Implementation
@Deprecated('Use `Momentum.controller<T>(context)` instead')
static T of<T extends MomentumController>(BuildContext context) {
T controller = _getMomentumInstance(context)!._getController<T>()!;
var lazyFirstCall = controller.strategy == BootstrapStrategy.lazyFirstCall;
if (controller.isLazy! && lazyFirstCall) {
controller._bootstrap();
controller._bootstrapAsync();
}
return controller;
}