Skip to content

Latest commit

History

History
26 lines (15 loc) 路 889 Bytes

File metadata and controls

26 lines (15 loc) 路 889 Bytes

The Map.update() method

A common requirement when working with maps is to:

  • Update the value if a given key already exists
  • Set the value if it doesn't

You may be tempted to implement some conditional logic to handle this.

But the update() method offers a simpler way of doing the same thing: 馃憞


Found this useful? Show some love and share the original tweet 馃檹

Also published on codewithandrea.com 馃憞


Previous Next
AsyncValue.guard() vs try/catch Riverpod: difference between ref.watch, ref.read, ref.listen