shutdown function
Sends a shutdown request over a channel.
On the remote side, the corresponding channel must have been passed to
DriftServer.serve
for this setup to work.
Also, the DriftServer
must have been configured to allow remote-shutdowns.
Implementation
Future<void> shutdown(StreamChannel<Object?> channel, {bool serialize = true}) {
final comm = DriftCommunication(channel, serialize: serialize);
return comm.request(NoArgsRequest.terminateAll).whenComplete(comm.close);
}