DriftIsolate class Null safety

Defines utilities to run drift in a background isolate. In the operation mode created by these utilities, there's a single background isolate doing all the work. Any other isolate can use the connect method to obtain an instance of a GeneratedDatabase class that will delegate its work onto a background isolate. Auto-updating queries, and transactions work across isolates, and the user facing api is exactly the same.

Please note that, while running drift in a background isolate can reduce latency in foreground isolates (thus reducing UI lags), the overall performance is going to be much worse as data has to be serialized and deserialized to be sent over isolates. Also, be aware that this api is not available on the web.

See also:

Constructors

DriftIsolate.fromConnectPort(SendPort connectPort)
Creates a DriftIsolate talking to another isolate by using the connectPort.
DriftIsolate.inCurrent(DatabaseOpener opener, {bool killIsolateWhenDone = false})
Creates a DriftIsolate in the Isolate.current isolate. The returned DriftIsolate is an object than can be sent across isolates - any other isolate can then use DriftIsolate.connect to obtain a special database connection which operations are all executed on this isolate. [...]
factory

Properties

connectPort SendPort
The underlying port used to establish a connection with this DriftIsolate. [...]
final
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

Methods

connect({bool isolateDebugLog = false}) Future<DatabaseConnection>
Connects to this DriftIsolate from another isolate. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
shutdownAll() Future<void>
Stops the background isolate and disconnects all DatabaseConnections created. If you only want to disconnect a database connection created via connect, use GeneratedDatabase.close instead.
toString() String
A string representation of this object. [...]
inherited

Operators

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

Static Methods

spawn(DatabaseOpener opener) Future<DriftIsolate>
Creates a new DriftIsolate on a background thread. [...]