ReactiveMap<K, V>.wrap constructor

ReactiveMap<K, V>.wrap(
  1. Map<K, V> map
)

Makes any map reactive by wrapping it.

If the argument is already a subclass of ReactiveMap, returns the argument.

Example

import 'package:kind/kind';

void main() {
  final map = <String,String>{'key': 'value'};
  final reactiveMap = ReactiveMap<String,String>.wrap(map);
}

Implementation

factory ReactiveMap.wrap(Map<K, V> map) {
  if (map is ReactiveMap<K, V>) {
    return map;
  }
  return _ReactiveMap<K, V>(map);
}