service<T extends MomentumService> static method

T service<T extends MomentumService>(
  1. BuildContext context, {
  2. bool runtimeType = true,
  3. dynamic alias,
})

The static method for getting services inside a widget. The service must be marked with MomentumService and injected into Momentum root widget.

Implementation

static T service<T extends MomentumService>(
  BuildContext context, {
  bool runtimeType = true,
  dynamic alias,
}) {
  return _getMomentumInstance(context)!._getService<T>(runtimeType: runtimeType, alias: alias);
}