MapNotifier<T, V> class

A Map that behaves like ValueNotifier if its data changes. it does not compare the elements on bulk operations If you set notifyIfEqual to false it will compare if a value passed value passed is equal to the existing value. like map[5]=4 if the content at index 4 is equal to 4 and only call notifyListeners if they are not equal. To allow atomic changes MapNotifier supports a single level of transactions

Inheritance
Implemented types
Mixed-in types

Constructors

MapNotifier({Map<T, V>? data, bool notifyIfEqual = false, bool customEquality(Map<T, V> x, Map<T, V> y)?})

Properties

customEquality bool Function(Map<T, V> x, Map<T, V> y)
final
entries Iterable<MapEntry<T, V>>
The map entries of this Map.
no setterinherited
hashCode int
The hash code for this object.
no setteroverride
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
isEmpty bool
Whether there is no key/value pair in the map.
no setterinherited
isNotEmpty bool
Whether there is at least one key/value pair in the map.
no setterinherited
keys Iterable<T>
The keys of this Map.
no setterinherited
length int
The number of key/value pairs in the map.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value Map<T, V>
The current value of the object. When the value changes, the callbacks registered with addListener will be invoked.
no setteroverride
values Iterable<V>
The values of this Map.
no setterinherited

Methods

addAll(Map<T, V> other) → void
Adds all key/value pairs of other to this map.
override
addEntries(Iterable<MapEntry<T, V>> entries) → void
Adds all key/value pairs of newEntries to this map.
override
addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
cast<K2, V2>() Map<K2, V2>
Provides a view of this map as having RK keys and RV instances, if necessary.
inherited
clear() → void
Removes all entries from the map.
override
containsKey(Object? key) bool
Whether this map contains the given key.
inherited
containsValue(Object? value) bool
Whether this map contains the given value.
inherited
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
inherited
forEach(void f(T, V)) → void
Applies action to each key/value pair of the map.
inherited
map<K2, V2>(MapEntry<K2, V2> transform(T, V)) Map<K2, V2>
Returns a new map where all entries of this map are transformed by the given convert function.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
If needed you can notifiy all listeners manually
override
putIfAbsent(T key, V ifAbsent()) → V
Look up the value of key, or add a new entry if it isn't there.
override
remove(Object? key) → V?
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(T key, V value)) → void
Removes all entries of this map that satisfy the given test.
override
retype<K2, V2>() Map<K2, V2>
inherited
toString() String
A string representation of this object.
inherited
update(T key, V update(V value), {V ifAbsent()?}) → V
Updates the value for the provided key.
override
updateAll(V update(T key, V value)) → void
Updates all values.
override

Operators

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