ReactiveScope class abstract
Base class for organizing multiple notifiers with auto-disposal.
ReactiveScope provides a way to group related notifiers and ensure they are all disposed together when the scope is disposed.
Use the built-in factory methods for concise, readable declarations:
class AppScope extends ReactiveScope {
late final counter = reactive(0);
late final users = reactiveList<User>();
late final settings = reactiveMap<String, dynamic>();
late final tags = reactiveSet<String>();
late final profile = asyncReactive<User>();
}
final scope = AppScope();
scope.counter.value = 5;
scope.users.add(User('Alice'));
scope.dispose(); // Disposes all notifiers
For custom notifier subclasses, use create directly:
late final search = create(ReactiveDebouncedNotifier<String>(
'', duration: Duration(milliseconds: 300),
));
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isDisposed → bool
-
Whether this scope has been disposed.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
asyncReactive<
T> () → ReactiveAsyncNotifier< T> - Creates a tracked ReactiveAsyncNotifier.
-
create<
T extends ChangeNotifier> (T notifier) → T - Tracks a notifier for automatic disposal.
-
dispose(
) → void - Disposes all tracked notifiers.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
persisted<
T> ({required String key, T? defaultValue, StorageAdapter? storage, String toJson(T)?, T fromJson(String)?, Duration persistDelay = const Duration(milliseconds: 100)}) → ReactivePersistedNotifier< T> - Creates a tracked ReactivePersistedNotifier.
-
reactive<
T> (T initialValue) → ReactiveNotifier< T> - Creates a tracked ReactiveNotifier with the given initial value.
-
reactiveList<
E> ([List< E> ? initial]) → ReactiveList<E> - Creates a tracked ReactiveList with optional initial elements.
-
reactiveMap<
K, V> ([Map< K, V> ? initial]) → ReactiveMap<K, V> - Creates a tracked ReactiveMap with optional initial entries.
-
reactiveSet<
E> ([Set< E> ? initial]) → ReactiveSet<E> - Creates a tracked ReactiveSet with optional initial elements.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited