When working with lists in Dart, you can use single
to:
- check if a list has only one element, and return that element
- throw an error if the list is empty or has more than one element
Useful when you run a function that returns a list with only one item. 馃憤
Found this useful? Show some love and share the original tweet 馃檹
Previous | Next |
---|---|
The Accessibility Tools package | Using serverTimestamp() in Firestore |