Did you know?
Since Dart 3, you can easily destructure lists using the spread operator (...).
Very handy for getting the first and last value. 👌
Note that if the list has only one element, you'll get a pattern matching error at runtime!
So make sure your assumptions are correct before using this. 👇
This example was taken from Pascal Welsch's talk about "Exploring Records and Patterns" at FlutterCon.
Check the slides for many more tips about this topic:
Found this useful? Show some love and share the original tweet 🙏
Previous | Next |
---|---|
Getting a Future from a FutureProvider with Riverpod |
Switch Matrix in Dart 3 |