title: Flutter Bloc cancel running event when a new one is recieved
body: <p>I have the follwing Bloc</p>
  <pre><code>class DeviceBloc extends Bloc&lt;DeviceEvent, DeviceState&gt; {
    DataRepository repository;
  
    DeviceBloc({@required this.repository}) : super(DeviceInitialState()) {
      on&lt;FetchDevicesEvent&gt;(onFetchResources);
    }
  
    Future&lt;void&gt; onFetchResources(
        FetchDevicesEvent event, Emitter&lt;DeviceState&gt; emit) async {
      emit.call(DeviceLoadingState());
  
      try {
        List&lt;DeviceResource&gt; devices = await repository.getResources(event.type);
        emit.call(DeviceLoadedState(devices: devices));
      } catch (e) {
        emit.call(DeviceErrorState(message: e.toString()));
      }
    }
  }
  </code></pre>
  <p>When FetchDevicesEvent event is triggered it starts a long running task, if additional FetchDevicesEvent events are recieved before the running task is completed the wrong result are returned to the caller. How can I suspend the awaited task and always start a new as soon as a new FetchDevicesEvent is recieved?</p>