remote function Null safety

DatabaseConnection remote(
  1. dynamic channel,
  2. {bool debugLog = false,
  3. bool serialize = true}
)

Connects to a remote server over a two-way communication channel.

On the remote side, the corresponding channel must have been passed to DriftServer.serve for this setup to work.

If serialize is true, drift will only send bool, int, double, Uint8List, String or List's thereof over the channel. Otherwise, the message may be any Dart object. The value of serialize for remote should be the same value passed to DriftServer.serve.

The optional debugLog can be enabled to print incoming and outgoing messages.

Implementation

DatabaseConnection remote(StreamChannel<Object?> channel,
    {bool debugLog = false, bool serialize = true}) {
  final client = DriftClient(channel, debugLog, serialize);
  return client.connection;
}