DriftIsolate.fromConnectPort constructor
Creates a DriftIsolate talking to another isolate by using the
connectPort
.
Internally, drift uses ports from dart:isolate
to send commands to an
internal server dispatching database actions.
In most setups, those ports can send and receive almost any Dart object.
In special cases though, the platform only supports sending simple types
across send types. In particular, isolates across different Flutter
engines (such as the ones spawned by the workmanager
package) are
unable to handle most objects.
To support these setups, drift can serialize the objects sent to the
background isolates into simple lists. This is adds considerable overhead,
but is necessary to make two independent isolates talk to each other.
The serialize
parameter can be used to explicitly enable or disable this
behavior. By default, drift will attempt to send a test message to infer
whether serialization is necessary or not.
Implementation
DriftIsolate.fromConnectPort(this.connectPort, {this.serialize});