DefaultMap<K, V>.filled constructor

DefaultMap<K, V>.filled(
  1. V defaultValue, [
  2. Map<K, V>? inner
])

Creates a DefaultMap with defaultValue as fallback, and inner as the map that will serve as the container map for the values.

It uses a newly created empty map as an internal map if inner is omitted.

See DefaultMap.generate constructors if you need more control over how the default value is constructed.

If you don't need to customize inner, it is recommended that you use the shorter DefaultMap constructor.

Implementation

DefaultMap.filled(V defaultValue, [Map<K, V>? inner])
    : _inner = inner ?? {},
      _getDefault = ((K key) => defaultValue);