connect method

Future<DatabaseConnection> connect({
  1. bool isolateDebugLog = false,
  2. bool singleClientMode = false,

Connects to this DriftIsolate from another isolate.

All operations on the returned DatabaseConnection will be executed on a background isolate.

When singleClientMode is enabled (it defaults to false), drift assumes that the isolate will only be connected to once. In this mode, drift will shutdown the remote isolate once the returned DatabaseConnection is closed. Also, stream queries are more efficient when this mode is enables since we don't have to synchronize table updates to other clients (since there are none).

Setting the isolateDebugLog is only helpful when debugging drift itself. It will print messages exchanged between the two isolates.


Future<DatabaseConnection> connect({
  bool isolateDebugLog = false,
  bool singleClientMode = false,
}) async {
  final connection = await connectToRemoteAndInitialize(
    debugLog: isolateDebugLog,
    serialize: serialize,
    singleClientMode: singleClientMode,

  return DatabaseConnection(connection.executor,
      streamQueries: connection.streamQueries, connectionData: this);