getService<T extends MomentumService> method

  1. @Deprecated('Use "service<T>()" instead')
T getService<T extends MomentumService>({
  1. bool runtimeType = true,
  2. dynamic alias,
})

A method for getting a service marked with MomentumService that are injected into Momentum root widget.

Implementation

@Deprecated('Use "service<T>()" instead')
T getService<T extends MomentumService>({bool runtimeType = true, dynamic alias}) {
  if (_context == null && _tester != null) {
    return _tester!.service<T>(alias: alias);
  }
  var momentum = Momentum._getMomentumInstance(_context!)!;
  return momentum._getService<T>(runtimeType: runtimeType, alias: alias);
}