singleOrNull<T> static method

T? singleOrNull<T>(
  1. Iterable<T>? items
)

Implementation

static T? singleOrNull<T>(Iterable<T>? items) {
  if (items?.length != 1) return null;
  return items?.first;
}