Ref class abstract
abstract class for creating refs.
final scoped = Ref.scoped((context) => AuthService());
final scopedFamily = Ref.scopedFamily((context, id) => ProductService(id));
final singleton = Ref.singleton(() => Database());
final transient = Ref.transient(() => APIClient());
Constructors
- Ref()
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
asyncSingleton<
T> (Future< T> create()) → AsyncSingletonRef<T> - Creates a new AsyncSingletonRef which always return the same instance.
-
asyncTransient<
T> (Future< T> create()) → AsyncTransientRef<T> - Creates a new AsyncTransientRef which always return a new instance.
-
scoped<
T> (CtxCreateFn< T> create, {DisposeFn<T> ? dispose, bool autoDispose = true}) → ScopedRef<T> - Creates a new ScopedRef which requires a context to access the instance.
-
scopedFamily<
T, F> (CtxFamilyCreateFn< T, F> create, {DisposeFn<T> ? dispose, bool autoDispose = true}) → ScopedFamilyRef<T, F> -
Creates a new ScopedFamilyRef which requires a context and family value
to access the instance.
The family value must be immutable and implement
==andhashCode. -
singleton<
T> (T create()) → SingletonRef< T> - Creates a new SingletonRef which always return the same instance.
-
transient<
T> (T create()) → TransientRef< T> - Creates a new TransientRef which always return a new instance.