listen abstract method
Listen to the channel for requests. If a request is received, invoke the
onRequest
function. If an error is encountered while trying to read from
the socket, invoke the onError
function. If the socket is closed by the
client, invoke the onDone
function. Only one listener is allowed per
channel.
Implementation
void listen(void Function(Request request) onRequest,
{Function? onError, void Function()? onDone});