I am migrating to Bloc 8.0.0 for state management. I have run into a problem that an Emitter for a Stream does not provide StreamSubscription rather a Future. I know, that I can use listen to get the subscription but I would like to keep consistency and use bloc way everywhere.
Is it possible to get a stream subscription while using forEach or onEach from Emitter? In my case, I want to pause a stream for some time and then resume it but there does not appear to be any way to get a subscription from emit.forEach<T>{}.
Example:
await emit.forEach<Model>(
myStream,
onData: (data) => state.copyWith(someData: data.someData),
);
In this example, there is no way to get the StreamSubscription. Stream is closed automatically. I would like to get a subscription object here, so that, I can pause the stream.
Maybe I missed some documentation or example. Any suggestion would be of great help.