toValue method

Object? toValue()

Converts this sequence to a native Dart value:

  • null if empty
  • the unwrapped value if single item
  • a List of unwrapped values otherwise

Implementation

Object? toValue() {
  if (isEmpty) return null;
  if (length == 1) return first.toValue();
  return [for (final item in this) item.toValue()];
}