single<T> method
Injects a single value into the Scope from a factory method.
The single's factory method may use values, other singles and sequences registered within the SAME Scope.
Each single is eagerly called when Scope.runSync is called and are fully resolved when the Scope.runSync's s action is called.
Scope()
..single<int>(ageKey, () => getDbConnection())
..run(() {}
Implementation
void single<T>(ScopeKey<T> key, T Function() factory) {
_checkDuplicateKey(key);
_singles.putIfAbsent(key, () => factory);
}