MapChangeNotifier<K, T> class

An implementation of ChangeNotifier that allows implementers to interact with this provider as if it were a Map and be notified when any changes to the map have been made

Like ChangeNotifier, this is optimized for small numbers of listeners. It is O(N) for adding and removing listeners.

K is the type of the Key to be used by this map. It is usually a String, but can be any subclass of Object. It must implement operator== and hashCode

T is the type of the Value to be used by this map. It can be any subclass of Object and has no special requirements.

Inheritance
Mixed in types

Constructors

MapChangeNotifier([Map<K, T> backingMap])

Properties

entries Iterable<MapEntry<K, T>>
The map entries of this.
read-only, inherited
hashCode int
The hash code for this object. [...]
read-only, inherited
hasListeners bool
Whether any listeners are currently registered. [...]
@protected, read-only, inherited
isEmpty bool
Returns true if there is no key/value pair in the map.
read-only, inherited
isNotEmpty bool
Returns true if there is at least one key/value pair in the map.
read-only, inherited
keys Iterable<K>
The keys of this. [...]
read-only, override
length int
The number of key/value pairs in the map.
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
values Iterable<T>
The values of this. [...]
read-only, inherited

Methods

addAll(Map<K, T> other) → void
Adds all the key/value pairs of other to this map. Listeners are notified after all values have been added. [...]
override
addEntries(Iterable<MapEntry<K, T>> newEntries) → void
Adds all the key/value pairs of newEntries to othis map. Listeners are notified after all the entries have been added. [...]
override
addListener(VoidCallback listener) → void
Register a closure to be called when the object changes. [...]
inherited
cast<RK, RV>() Map<RK, RV>
Provides a view of this map as having RK keys and RV instances, if necessary. [...]
inherited
clear() → void
Removes all pairs from the map. [...]
override
containsKey(Object key) bool
Returns true if this map contains the given key. [...]
inherited
containsValue(Object value) bool
Returns true if this map contains the given value. [...]
inherited
dispose() → void
Discards the internal resources used by the object. After this is called, the object is not in a usable state and should be discarded. [...]
@mustCallSuper, override
forEach(void action(K key, T value)) → void
Applies f to each key/value pair of the map. [...]
inherited
map<K2, V2>(MapEntry<K2, V2> transform(K key, T value)) Map<K2, V2>
Returns a new map where all entries of this map are transformed by the given f function.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
notifyListeners() → void
Notify all the listeners, respecting our paused state falg
inherited
pauseNotifications<T>(ChangeHandler<T> handler, [bool notifyAfter = false]) → T
Pause notifications until after a synchronous handler has completed. If notifyAfter is true, then listeners will automatically be notified after the callback completes. Otherwise, you must notify the listeners;
inherited
pauseNotificationsAsync<T>(AsyncChangeHandler<T> handler, [bool notifyAfter = false]) Future<T>
Pause notifications until after an asynchronous handler has completed. If notifyAfter is true, then listeners will automatically be notified after the callback completes. Otherwise, you must notify the listeners;
inherited
putIfAbsent(K key, T ifAbsent()) → T
Look up the value of key, or add a new value if it isn't there. [...]
inherited
remove(Object key) → T
Removes key and its associated value, if present, from the map. [...]
override
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes. [...]
inherited
removeWhere(bool test(K key, T value)) → void
Remove all entries of this map that satisfy test Listeners are notified after all removals have taken place. [...]
override
toString() String
Returns a string representation of this object.
inherited
update(K key, T update(T value), {T ifAbsent()}) → T
Updates the value for the provided key. [...]
inherited
updateAll(T update(K key, T value)) → void
Updates all values. Listeners are notified after all values have been updated. [...]
override

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited
operator [](Object key) → T
Returns the value for the given key or null if key is not in the map.
override
operator []=(K key, T value) → void
Associates the key with the given value. [...]
override