registerService<T extends Object> method

void registerService<T extends Object>(
  1. T implementation
)

Registers implementation under the type T; the last write wins.

Pass the interface type explicitly, otherwise the implementation's concrete type is inferred and lookups by interface fail: scope.registerService<ClipboardService>(SystemClipboardService()).

Implementation

void registerService<T extends Object>(T implementation) {
  _services[T] = implementation;
}