Scope
Scope provides Inversion of Control using the dependency injection (DI) pattern for Dart applications.
Scope allows you to inject values into a scope and then 'use' those dependencies from any method (or constructor) called within that scope.
Scope provides DI for your call stack.
This is most easily understood via an example:
We create a Scope within main and call the method a()
which calls b()
. Both a() and b() are within the declared scope and therefore have access to the injected value ageKey
.
To access an injected value you call the use
method.
Last updated