expose<T> abstract method
Use scope.expose<T>(...)
to expose instance within current scope,
this instance can be resolved later:
final rootScope = await Scope.root([
Configurable((scope) {
final repository = Repository();
// expose repository
scope.expose<Repository>(
expose: () => repository,
);
})
]);
// resolve repository
final repository = rootScope.get<Repository>();
Provide name
to expose instance with specific name:
scope.expose<Repository>(
name: 'repository',
expose: () => repository,
);
Implementation
void expose<T>({
Object? name,
required Getter<T> expose,
});