The documentation:
Whether to generate a
==/hashcode
or not If null, picks up the default values from the project'sbuild.yaml
. If that value is null too, generates a ==/hashcode only if the class does not have a custom ==
Does this replace the need of extending Equitable when comparing classes created by Freezed?
Would these result in the same behaviour?
@Freezed(equal: true)
class LanguageState with _$LanguageState {
const factory LanguageState.initial({required Locale currentLocale}) =
_Initial;
const factory LanguageState.languageChanged({required Locale currentLocale}) =
_LanguageChanged;
And something like:
abstract class LanguageState extends Equatable{
const LanguageState._();
String get currentLocale;
@override
List<Object?> get props => [currentLocale];
}
class LanguageInitial extends LanguageState{
const LanguageInitial({required this.currentLocale}) : super._();
@override
final String currentLocale;
}
class LanguageChanged extends LanguageState{
const LanguageChanged({required this.currentLocale}) : super._();
@override
final String currentLocale;
}
I am using freezed with bloc and want the bloc to update whenever the currentLocale
changes, even if the type of the state is the same.