IMapConst<K, V> constructor

  1. @literal
const IMapConst<K, V>(
  1. Map<K, V> _map, [
  2. ConfigMap config = const ConfigMap()
])

To create an empty constant IMap: const IMapConst({}). To create a constant map with entries: const IMapConst({1:'a', 2:'b', 3:'c'}).

IMPORTANT: You must always use the const keyword. It's ALWAYS wrong to use an IMapConst which is not constant.

Implementation

@literal
const IMapConst(this._map,
    // Note: The _map can't be optional. This doesn't work: [this._map = const {}]
    // because when you do this _map will be Map<Never, Never> which is bad.
    [this.config = const ConfigMap()])
    : super._gen();