singleOrNull property
T?
singleOrNull
Checks that the list has only one element, and returns that element.
Return null
if the list is empty or has more than one element.
Implementation
T? get singleOrNull => length != 1 ? null : single;