flutter subscription stopped stream code example
Example: flutter stream stop listen
// Pre-declare variable (can't be final, though).
StreamSubscription<Map<PlaceParam, dynamic>> subscription;
subscription = stream.listen((event) {
.... subscription.cancel();
});