jkrecek / home-controller-flutter

Mobile app for that connects to home-controller-go's API.
1 stars 0 forks source link

Stream leaking #1

Open Nazacheres opened 3 years ago

Nazacheres commented 3 years ago

This will produce an uncontrolled stream. Create new Composite Stream, and dispose it in blocs @close.

https://github.com/jkrecek/home-controller-flutter/blob/c2b0ea3e1b46e5c971d71ba50f8a069182e5167d/lib/bloc/dashboard/dashboard_bloc.dart#L19

jkrecek commented 3 years ago

Im kinda fake closing it here https://github.com/jkrecek/home-controller-flutter/blob/c2b0ea3e1b46e5c971d71ba50f8a069182e5167d/lib/services/api_service.dart#L31

is it not enough?

Nazacheres commented 3 years ago

It closes the previous subscription on the new call (if that's what you want - cool). Also on dispose, but I don't see where dispose is called. IMHO it should be explicitly controlled in bloc. Currently, if bloc is disposed it will keep shooting new events.