serve method Null safety

void serve(
  1. dynamic channel,
  2. {bool serialize = true}

Starts processing requests from the channel.

The channel uses a drift-internal protocol to serialize database requests. Drift assumes full control over the channel. Manually sending messages over it, or closing it prematurely, can disrupt the server.

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.

Warning: As long as this library is marked experimental, the protocol might change with every drift version. For this reason, make sure that your server and clients are using the exact same version of the drift package to avoid conflicts.


void serve(StreamChannel<Object?> channel, {bool serialize = true});