listen method
StreamSubscription<String>
listen(
- void onMessage(
- ProtocolMessage message
- Function? onError,
- void onDone()?,
Implementation
StreamSubscription<String> listen(
void Function(ProtocolMessage message) onMessage,
{Function? onError,
void Function()? onDone}) {
return _input.transform(PacketTransformer()).listen(
(String data) => _readMessage(data, onMessage),
onError: onError,
onDone: () {
close();
if (onDone != null) {
onDone();
}
},
);
}