fix event.islocal

This commit is contained in:
Salvatore Giordano
2021-04-20 09:53:39 +02:00
parent 4a094629d1
commit a49d99210e
2 changed files with 8 additions and 8 deletions
@@ -32,13 +32,11 @@ class Event {
});
/// Create a new instance from a json
factory Event.fromJson(Map<String, dynamic> json) => _$EventFromJson({
...Serialization.moveToExtraDataFromRoot(
json,
topLevelFields,
),
'is_local': false,
});
factory Event.fromJson(Map<String, dynamic> json) =>
_$EventFromJson(Serialization.moveToExtraDataFromRoot(
json,
topLevelFields,
));
/// The type of the event
/// [EventType] contains some predefined constant types
@@ -90,7 +88,7 @@ class Event {
final String? parentId;
/// True if the event is generated by this client
@JsonKey(ignore: true)
@JsonKey(defaultValue: false)
final bool isLocal;
/// Map of custom channel extraData
@@ -39,6 +39,7 @@ Event _$EventFromJson(Map<String, dynamic> json) {
channelType: json['channel_type'] as String?,
parentId: json['parent_id'] as String?,
extraData: json['extra_data'] as Map<String, dynamic>? ?? {},
isLocal: json['is_local'] as bool? ?? false,
);
}
@@ -59,6 +60,7 @@ Map<String, dynamic> _$EventToJson(Event instance) => <String, dynamic>{
'unread_channels': instance.unreadChannels,
'online': instance.online,
'parent_id': instance.parentId,
'is_local': instance.isLocal,
'extra_data': instance.extraData,
};