drain method

Future<void> drain (
  1. String channel,
  2. DrainChannelCallback callback

Remove and process all stored messages for a given channel.

This should be called once a channel is prepared to handle messages (i.e. when a message handler is setup in the framework).


Future<void> drain(String channel, DrainChannelCallback callback) async {
  while (!_isEmpty(channel)) {
    final _StoredMessage message = _pop(channel);
    await callback(message.data, message.callback);