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 🙏
Previous | Next |
---|---|
AsyncValue.guard() vs try /catch |
Riverpod: difference between ref.watch , ref.read , ref.listen |