BLoC state management modifications #461
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi again, great work; I had made some changes for it to match with BLoC pattern; if you think that this can be helpful consider on merging or making a secondary tree, since I made some refactors and adding a controller.
Here you can see how I implemented it with firebase_auth.
https://github.com/vcadillog/flutter_firebase_login_bloc_pattern/blob/master/lib/login/view/login_form.dart
Some things to note when isBlocPattern = true (the flag for bloc). It skips all the error handling logic, since I do it in the BLoC repository layer and for that reason I create a Flushbar myself.
Additional changes included, for example in login_form.dart file:
176 await _submitController.forward();
177 setState(() => _isSubmitting = true);
This code potentially leads to a dispose controller error, because if the user taps fast enought the forgot password screen before the setState takes action it disposes the submitController; so I swapped the order to ensure _isSubmitting is true and disable undesired gestures.