consume method

void consume(
  1. Cmd<Msg> cmd
)

This helper function can be used in different scenarios where you have a Cmd and need to process them using an available dispatch in the context.

One of such scenarios could be integration tests to guarantee the messages being emitted or in subscriptions where you have a dispatch function that you might want to share a Cmd in response to an event.

Implementation

void consume(Cmd<Msg> cmd) {
  cmd.consumeWith(this);
}