W3cubDocs

/Dart 2

update method

V update (K key, V update(V value), { V ifAbsent() })

Updates the value for the provided key.

Returns the new value of the key.

If the key is present, invokes update with the current value and stores the new value in the map.

If the key is not present and ifAbsent is provided, calls ifAbsent and adds the key with the returned value to the map.

It's an error if the key is not present and ifAbsent is not provided.

Implementation

V update(K key, V update(V value), {V ifAbsent()});

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/2.0.0/dart-core/Map/update.html