toObservableMap<K, V> function

ObservableMap<K, V> toObservableMap<K, V>(
  1. Map<K, V> value, {
  2. bool deep = true,
})

Converts the Map to an ObservableMap.

If value is already Observable, it will be returned unmodified.

The returned value will use the appropriate kind of backing map: either HashMap, LinkedHashMap, or SplayTreeMap.

By default this performs a deep conversion, but you can set deep to false for a shallow conversion. This does not handle circular data structures. If a conversion is peformed, mutations are only observed to the result of this function. Changing the original collection will not affect it.

Implementation

ObservableMap<K, V> toObservableMap<K, V>(Map<K, V> value, {bool deep = true}) {
  if (value is ObservableMap<K, V>) return value;
  return (deep ? _toObservableDeepMap(value) : _toObservableShallow(value))
      as ObservableMap<K, V>;
}