listen abstract method

void listen(
  1. void onResponse(
    1. Response response
    ),
  2. void onNotification(
    1. Notification notification
    ), {
  3. void onError(
    1. dynamic error
    )?,
  4. void onDone()?,
})

Listen to the channel for responses and notifications. If a response is received, invoke the onResponse function. If a notification is received, invoke the onNotification function. If an error is encountered while trying to read from the socket, invoke the onError function. If the socket is closed by the plugin, invoke the onDone function. Only one listener is allowed per channel.

Implementation

void listen(void Function(Response response) onResponse,
    void Function(Notification notification) onNotification,
    {void Function(dynamic error)? onError, void Function()? onDone});