firstOrNull property
T?
get
firstOrNull
Returns the first element. If there is no first element it will
return null
.
Example:
['a', 'b'].firstOrNull); // 'a'
[].firstOrNull); // null
Implementation
T? get firstOrNull => length == 0 ? null : first;