SingleSelectable<T> class abstract

Selectable methods for returning or streaming single, non-nullable results.

Useful for refining the return type of a query, while still delegating whether to getSingle or watchSingle results to the consuming code.

// Retrieve a todo known to exist.
SingleSelectable<Todo> entryById(int id) {
  return select(todos)..where((t) => t.id.equals(id));
}
final idGuaranteedToExist = 10;
entryById(idGuaranteedToExist).getSingle();
entryById(idGuaranteedToExist).watchSingle();

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

Implementers

Constructors

SingleSelectable()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

getSingle() Future<T>
Executes this statement, like Selectable.get, but only returns one value. the query returns no or too many rows, the returned future will complete with an error.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
watchSingle() Stream<T>
Creates an auto-updating stream of this statement, similar to Selectable.watch. 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, at any point, the query emits no or more than one rows, an error will be added to the stream instead.

Operators

operator ==(Object other) bool
The equality operator.
inherited