File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 55import 'package:equatable/equatable.dart' ;
66import 'package:json_annotation/json_annotation.dart' ;
77
8+ import '../generate_id.dart' ;
89import '../mixins.dart' ;
910import 'models.dart' ;
1011
@@ -162,7 +163,11 @@ class Effect with EquatableMixin, SerializableMixin {
162163 ];
163164
164165 /// Factory constructor for creating new [Effect] from JSON data.
165- factory Effect .fromJson (Map json) => _$EffectFromJson (json);
166+ factory Effect .fromJson (Map json) => _$EffectFromJson ({
167+ // TODO: backward compatibility, remove in 1.0.0
168+ 'id' : generateId (),
169+ ...json,
170+ });
166171
167172 @override
168173 Map toJson () => _$EffectToJson (this );
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ enum ImageRepeatEnum {
3838@JsonSerializable ()
3939class PaintModel with EquatableMixin , SerializableMixin {
4040 /// identifier of this paint.
41+ @JsonKey (required : true )
4142 final String id;
4243
4344 /// Type of paint.
@@ -480,6 +481,7 @@ class PaintModel with EquatableMixin, SerializableMixin {
480481
481482 @override
482483 List <Object ?> get props => [
484+ id,
483485 type,
484486 visible,
485487 opacity,
@@ -505,7 +507,11 @@ class PaintModel with EquatableMixin, SerializableMixin {
505507 ];
506508
507509 /// Factory constructor for creating [PaintModel] instance from a JSON data.
508- factory PaintModel .fromJson (Map json) => _$PaintModelFromJson (json);
510+ factory PaintModel .fromJson (Map json) => _$PaintModelFromJson ({
511+ // TODO: backward compatibility, remove in 1.0.0
512+ 'id' : generateId (),
513+ ...json,
514+ });
509515
510516 @override
511517 Map toJson () => _$PaintModelToJson (this );
You can’t perform that action at this time.
0 commit comments