NonEmptyList<T> constructor
- List<
T> items
Constructs a NonEmptyList.
Throws an ArgumentError if the provided list is empty.
Implementation
NonEmptyList(List<T> items)
: _items = items.isNotEmpty
? List.unmodifiable(items)
: throw ArgumentError('List must not be empty');