mapSet method

FunctionExpression mapSet(
  1. Object key,
  2. Object? value, [
  3. List<Object?> moreKeyValues = const <Object?>[]
])

This map with key set to value.

moreKeyValues continues with further key/value pairs: mapSet('a', 1, ['b', 2]) sets both a and b.

Implementation

FunctionExpression mapSet(
  Object key,
  Object? value, [
  List<Object?> moreKeyValues = const <Object?>[],
]) {
  if (moreKeyValues.length.isOdd) {
    throw ArgumentError(
      'mapSet() takes key/value pairs, but moreKeyValues has an odd number '
      'of elements: $moreKeyValues',
    );
  }
  return _function('map_set', <Object?>[key, value, ...moreKeyValues]);
}