Skip to content

Get a single item from a list

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. 👍

Previous Next
The Accessibility Tools package Using serverTimestamp() in Firestore

Last update: 18 septembre 2023
Created: 18 septembre 2023