brianegan / brianegan/flutter_architecture_samples
flutter_architecture_samples/firestore_redux/ how can I store the StreamSubscriptions?
- Dominant language
- Dart
- Stars
- 8.9k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
Hi Brian,
I'm looking for a solution for storing streamsubscriptions in my middleware. How I can store the streamsubscription and cancel them if i need too?
Especially in flutter_architecture_samples/firestore_redux/lib/middleware/store_todos_middleware.dart line 66 / 67 there is a `listen()` which returns a subscription but it is not stored? How do you cancel the subscription?
In the E-Mail from Nilay couple days ago, there was a suggestion for using streamsubscriptions and canceling them.
http://dart-lang.github.io/linter/lints/cancel_subscriptions.html
```
class B {
StreamSubscription _subscriptionB;
void init(Stream stream) {
_subscriptionB = stream.listen((_) {});
}
void dispose(filename) {
_subscriptionB.cancel();
}
}
```
And I need in my code the fully control of the subscriptions. I would very appreciate your answer.
Cheers, :)
Contributor guide
Research direction
Start with flutter_architecture_samples/firestore_redux/lib/middleware/store_todos_middleware.dart, especially the listen() calls on lines 66–67. Trace the middleware's lifecycle and determine where the returned StreamSubscriptions should be retained and cancelled; done means the subscriptions can be explicitly controlled without changing the sample's todo behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, firebase, flutter
- Domain
- databases, mobile
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100