First I want to thank you for this awesome lib with an outstanding documentation! Impressive work!
Describe the bug
The yielded state is only applied once.
Only the first yielded state is used to replace the initial state.
After that, all yielded states are ignored and the state stays at the first input.
To Reproduce
Steps to reproduce the behavior:
flutter pub run build_runner watch --delete-conflicting-outputs*Logs *
Analysis Errors are either from the debug prints, deleting of firebase for this report or in generated code.
Analyzing flutter_firebase_ddd...
info • Avoid `print` calls in production code • lib/application/auth/sign_in_form/sign_in_form_bloc.dart:31:9 • avoid_print
info • Avoid `print` calls in production code • lib/application/auth/sign_in_form/sign_in_form_bloc.dart:33:9 • avoid_print
info • Avoid single cascade in expression statements • lib/application/auth/sign_in_form/sign_in_form_bloc.freezed.dart:445:5 • avoid_single_cascade_in_expression_statements
info • Avoid single cascade in expression statements • lib/application/auth/sign_in_form/sign_in_form_bloc.freezed.dart:575:5 • avoid_single_cascade_in_expression_statements
info • Avoid single cascade in expression statements • lib/application/auth/sign_in_form/sign_in_form_bloc.freezed.dart:702:5 • avoid_single_cascade_in_expression_statements
info • The declaration '_$identity' isn't referenced • lib/domain/auth/auth_failure.freezed.dart:10:3 • unused_element
info • Avoid `print` calls in production code • lib/domain/auth/value_objects.dart:11:5 • avoid_print
info • Sort directive sections alphabetically • lib/injection.config.dart:14:1 • directives_ordering
info • Sort directive sections alphabetically • lib/injection.config.dart:15:1 • directives_ordering
info • Unused import: 'package:firebase_core/firebase_core.dart' • lib/main.dart:1:8 • unused_import
info • Sort pub dependencies • pubspec.yaml:26:3 • sort_pub_dependencies
info • Sort pub dependencies • pubspec.yaml:44:3 • sort_pub_dependencies
12 issues found. (ran in 4.1s)
r0@haggindosh flutter_firebase_ddd % flutter doctor -v
[✓] Flutter (Channel master, 1.24.0-8.0.pre.157, on Mac OS X 10.15.4 19E287 darwin-x64, locale en)
• Flutter version 1.24.0-8.0.pre.157 at /Users/r0/flutter
• Framework revision 4c511fbde2 (4 hours ago), 2020-11-09 11:53:56 -0800
• Engine revision 3cf2922269
• Dart version 2.12.0 (build 2.12.0-28.0.dev)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/r0/Library/Android/sdk
• Platform android-29, build-tools 29.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.4, Build version 11E146
• CocoaPods version 1.9.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] IntelliJ IDEA Ultimate Edition (version 2020.1)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
[✓] VS Code (version 1.50.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.15.1
[✓] Connected device (4 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• macOS (desktop) • macos • darwin-x64 • Mac OS X 10.15.4 19E287 darwin-x64
• Web Server (web) • web-server • web-javascript • Flutter Tools
• Chrome (web) • chrome • web-javascript • Google Chrome 86.0.4240.193
• No issues found!
Additional context
I added some sophisticated debugging technique for you to see issue in the console ...
Main files for this are:
lib/application/auth/sign_in_form/sign_in_form_bloc.dart
lib/presentation/sign_in/widgets/sign_in_form.dart
Hi! If you are yielding the same states with different content, the bloc could ignore to avoid duplicate states if you don´t implement equatable. Do you have the states classes to help you?
Thanks found the error.
@alfredobs97 thanks for getting me into the right direction, I had a wrong get hashcode override. in
https://github.com/rokk4/flutterblocreport/blob/nofirebase/lib/domain/core/value_objects.dart
@override
int get hashCode => 0;
Is not so good ^^.
I did not use equatable here because I could not find something about its usage in abstract generic classes, so I did it manually and of course made an error.
In the state class equatable is not used because the overide of == is done by the freezed packages.
Now everything works, thanks again!
Most helpful comment
Hi! If you are yielding the same states with different content, the bloc could ignore to avoid duplicate states if you don´t implement equatable. Do you have the states classes to help you?