executeStream method
Execute a Stream.
This function is a sugar code used to run a Stream in a simple way, executing setLoading and adding to setError if an error occurs in Stream
Implementation
StreamSubscription executeStream(Stream<State> stream) {
StreamSubscription sub = stream.listen(
update,
onError: (error) => setError(error, force: true),
onDone: () => setLoading(false),
);
return sub;
}