class ObservableMap<K, V>


Represents an observable map of model values. If any items are added, removed, or replaced, then observers that are listening to changes will be notified.

Inheritance
Implements
  • Map<K, V>

Constructors

ObservableMap()

Creates an observable map.

ObservableMap.createFromType(Map<K, V> other)

Like ObservableMap.from, but creates an empty map.

factory
ObservableMap.from(Map<K, V> other)

Creates an observable map that contains all key value pairs of other. It will attempt to use the same backing map type if the other map is a LinkedHashMap, SplayTreeMap, or HashMap. Otherwise it defaults to HashMap.

factory
ObservableMap.linked()

Creates a new observable map using a LinkedHashMap.

ObservableMap.sorted()

Creates a new observable map using a SplayTreeMap.

Properties

changes → Stream<List<ChangeRecord>>

read-only, inherited
hashCode → int

Get a hash code for this object.

read-only, inherited
hasObservers → bool

True if this object has any observers, and should call notifyPropertyChange for changes.

read-only, inherited
isEmpty → bool

read-only
isNotEmpty → bool

read-only
keys → Iterable<K>

read-only
length → int

read-only
runtimeType → Type

A representation of the runtime type of the object.

read-only, inherited
values → Iterable<V>

read-only

Operators

operator ==(other) → bool

The equality operator.

inherited
operator [](Object key) → V

Returns the value for the given key or null if key is not in the map.

operator []=(K key, V value) → void

Associates the key with the given value.

Methods

addAll(Map<K, V> other) → void

Adds all key-value pairs of other to this map.

clear() → void

Removes all pairs from the map.

containsKey(Object key) → bool

Returns true if this map contains the given key.

containsValue(Object value) → bool

Returns true if this map contains the given value.

deliverChanges() → bool

Synchronously deliver pending changes. Returns true if any records were delivered, otherwise false.

inherited
forEach(void f(K key, V value)) → void

Applies f to each key-value pair of the map.

noSuchMethod(Invocation invocation) → dynamic

Invoked when a non-existent method or property is accessed.

inherited
notifyChange(ChangeRecord record) → void

Notify observers of a change.

inherited
notifyPropertyChange(Symbol field, Object oldValue, Object newValue) → dynamic

Notify that the field name of this object has been changed.

inherited
observed() → void

Override this method to be called when the changes are first observed.

inherited
putIfAbsent(K key, V ifAbsent()) → V

Look up the value of key, or add a new value if it isn't there.

remove(Object key) → V

Removes key and its associated value, if present, from the map.

toString() → String

Returns a string representation of this object.

unobserved() → void

Override this method to be called when the changes are no longer being observed.

inherited