ComputedMap<K, V>.fromPiecewise constructor

ComputedMap<K, V>.fromPiecewise(
  1. Iterable<K> domain,
  2. V f(
    1. K key
    )
)

Constructs a constant ComputedMap defined by f over the key domain domain.

The main advantage over ComputedMap.fromIMap is that only the reactively used keys are computed.

Make sure either:

  • domain is finite or
  • snapshot is never used.

Implementation

factory ComputedMap.fromPiecewise(Iterable<K> domain, V Function(K key) f) =>
    PiecewiseComputedMap(domain, f);