Open Ezirius opened 4 years ago
Question: I get an error message 'The getter 'showErrorMEssages' was called on null. I got this message once I upgraded. Is this is what you are referring to ?
With the following versions in dependencies and dev_dependencies in pubspec.yaml:
dependencies: dartz: ^0.9.1 freezed_annotation: ^0.11.0 flutter_bloc: ^6.0.1
dev_dependencies: build_runner: ^1.10.0 freezed: ^0.11.
I get the following on "AuthBloc(this._authFacade);":
The superclass 'Bloc<AuthBlocEvent, AuthBlocState>' doesn't have a zero argument constructor. Try declaring a zero argument constructor in 'Bloc<AuthBlocEvent, AuthBlocState>', or explicitly invoking a different constructor in 'Bloc<AuthBlocEvent, AuthBlocState>'.dart(no_default_super_constructor)
Remember that you need to add the following override otherwise you will get a "requires the 'non-nullable' language feature to be enabled" error with build_runner:
dependency_overrides: analyzer: ^0.39.14
I presume that there is a bug in analyzer 0.39.15?
I am just not getting it on your comment with related to AuthBoc.
In bloc.dart...
The Bloc definition in 4.0.0 is:
abstract class Bloc<Event, State> extends Stream<State> implements Sink<Event> {
...
/// {@macro bloc}
Bloc() {
_state = initialState;
_bindEventsToStates();
}
...
The Bloc definition in 6.0.1 is:
abstract class Bloc<Event, State> extends Cubit<State>
implements EventSink<Event> {
/// {@macro bloc}
Bloc(State initialState) : super(initialState) {
_bindEventsToStates();
}
...
Therefore you get the compile time error, "The superclass 'Bloc<AuthBlocEvent, AuthBlocState>' doesn't have a zero argument constructor."
I was not clear or I have no clue at all. I am not getting a compile error, i think. It is runtime. If i down grade to flutter_bloc: ^4.0.0 No issue at all.
return Form( autovalidate: state.showErrorMessages, <---- Generates Error. state has a null. ════════ Exception caught by widgets library ═══════════════════════════════════ The following NoSuchMethodError was thrown building BlocBuilder<SignInFormBloc, SignInFormState>(dirty, state: _BlocBuilderBaseState<SignInFormBloc, SignInFormState>#2d670): The getter 'showErrorMessages' was called on null. Receiver: null Tried calling: showErrorMessages
The relevant error-causing widget was BlocConsumer<SignInFormBloc, SignInFormState> package:notes_firebase_ddd_course/…/widgets/sign_in_form.dart:13 When the exception was thrown, this was the stack
package:notes_firebase_ddd_course/…/widgets/sign_in_form.dart:40
Okay, so there are at least 2 separate issues that need to be solved to upgrade the BLoC library to the latest version
Yes. Does the fix need to be part of Bloc or the application?
In the app to accommodate the breaking changes implemented in the BLoC library
I will stay at 4.0.0 until there is a fix. I am working on an APP that stopped working with the New Bloc.
@rdhillbb, not BLoC related, but may help in terms of understanding/implementing Clean Architecture and TDD:
All I did was take the finished code and upgraded to 6.0.1. No modifications. I will take your suggestions.
Glad that worked. Thanks for the update.
Thanks for the awesome tutorials. Please upgrade the project to the latest BLoC package.