DatabaseConnection constructor
DatabaseConnection(
- QueryExecutor executor, {
- StreamQueryStore? streamQueries,
- FutureOr<
Object?> connectionData, - bool closeStreamsSynchronously = false,
Constructs a raw database connection from the executor and optionally a
specified streamQueries implementation to use.
When creating a default stream query implementation,
closeStreamsSynchronously determines whether drift stops query streams
immediately after the last listener detaches. By default, drift will wait
for one event loop iteration to avoid duplicate work for e.g.
StreamBuilder setups that reconnect on rebuilds. Enabling that option
may be useful in test setups that throw exceptions for timers persisting
after tests.
Implementation
DatabaseConnection(
this.executor, {
StreamQueryStore? streamQueries,
this.connectionData,
bool closeStreamsSynchronously = false,
}) : streamQueries = streamQueries ??
switch (executor) {
DatabaseConnection() => executor.streamQueries,
_ => StreamQueryStore(
closeStreamsSynchronously: closeStreamsSynchronously)
};