Re-add custom hashCode and == on MessageConfig, fixing constant MessageController reloads due to room changing
This commit is contained in:
parent
cdba3c480e
commit
08cca4d3d3
1 changed files with 10 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ part "message_config.g.dart";
|
|||
|
||||
@freezed
|
||||
abstract class MessageConfig with _$MessageConfig {
|
||||
const MessageConfig._();
|
||||
const factory MessageConfig({
|
||||
@Default(false) bool alwaysReturn,
|
||||
@Default(false) bool includeEdits,
|
||||
|
|
@ -13,6 +14,15 @@ abstract class MessageConfig with _$MessageConfig {
|
|||
required Event event,
|
||||
}) = _MessageConfig;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
other.runtimeType == runtimeType &&
|
||||
other is MessageConfig &&
|
||||
other.event == event;
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, event);
|
||||
|
||||
factory MessageConfig.fromJson(Map<String, Object?> json) =>
|
||||
_$MessageConfigFromJson(json);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue