Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
BlocBuilder condition bug - _previousState == null #328
First off, thanks for including the condition :)
I think there's a bug in _BlocBuilderBaseState. If I initialize a BlocBuilder with a condition, previousState defaults to null even if the provided bloc has an existing state...so the listener built in _subscribe() necessarily throws a null error on the bloc's next state change (assuming you're using an operator on previousState).
I think this can be fixed by setting _previousState = widget.bloc.currentState in the initState() method...ie. same assignment as state.