SingleOrNullSelectable<T> class Null safety

Selectable methods for returning or streaming single, nullable results.

Useful for refining the return type of a query, while still delegating whether to getSingleOrNull or watchSingleOrNull result to the consuming code.

// Retrieve a todo from an external link that may not be valid.
SingleOrNullSelectable<Todo> entryFromExternalLink(int id) {
  return select(todos)..where((t) =>;
final idFromEmailLink = 100;

See also: MultiSelectable for exposing multi-value methods and SingleSelectable for exposing non-nullable value methods.





hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


getSingleOrNull() Future<T?>
Executes this statement, like Selectable.get, but only returns one value. If the result too many values, this method will throw. If no row is returned, null will be returned instead. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
toString() String
A string representation of this object. [...]
watchSingleOrNull() Stream<T?>
Creates an auto-updating stream of this statement, similar to However, it is assumed that the query will only emit one result, so instead of returning a Stream<List<T>>, this returns a Stream<T?>. If the query emits more than one row at some point, an error will be emitted to the stream instead. If the query emits zero rows at some point, null will be added to the stream instead. [...]


operator ==(Object other) bool
The equality operator. [...]