scoped_zone library

A simple dependency injection library built on Zones

Classes

ScopedRef<T>
A reference to a scoped value.

Functions

create<T>(T create()) ScopedRef<T>
Creates a ScopedRef which can later be used to access the value, T returned by create.
read<T>(ScopedRef<T> ref, {T orElse()?}) → T
Attempts to retrieve the value for the ref. If read is called with a ref which is not available in the current scope, a StateError will be thrown.
runScoped<R>(R body(), {Set<ScopedRef> values = const {}}) → R
Runs body within a scope which has access to the set of refs in values.
runScopedGuarded<R>(R body(), {required void onError(Object error, StackTrace stack), Set<ScopedRef> values = const {}}) → R?
Runs body within a scope which has access to the set of refs in values.