Line data Source code
1 : import 'package:equatable/equatable.dart';
2 : import 'package:json_annotation/json_annotation.dart';
3 :
4 : part 'activity_update.g.dart';
5 :
6 : ///
7 : @JsonSerializable()
8 : class ActivityUpdate extends Equatable {
9 : ///
10 4 : const ActivityUpdate({
11 : required this.set,
12 : required this.unset,
13 : this.id,
14 : this.foreignId,
15 : this.time,
16 : });
17 :
18 : ///
19 2 : factory ActivityUpdate.withId(
20 : String id,
21 : Map<String, Object> set,
22 : List<String> unset,
23 : ) =>
24 2 : ActivityUpdate(
25 : id: id,
26 : set: set,
27 : unset: unset,
28 : );
29 :
30 : ///
31 1 : factory ActivityUpdate.withForeignId(
32 : String foreignId,
33 : DateTime time,
34 : Map<String, Object> set,
35 : List<String> unset,
36 : ) =>
37 1 : ActivityUpdate(
38 : foreignId: foreignId,
39 : time: time,
40 : set: set,
41 : unset: unset,
42 : );
43 :
44 : /// Create a new instance from a json
45 1 : factory ActivityUpdate.fromJson(Map<String, dynamic> json) =>
46 1 : _$ActivityUpdateFromJson(json);
47 :
48 : ///
49 : @JsonKey(includeIfNull: false)
50 : final String? id;
51 :
52 : ///
53 : @JsonKey(includeIfNull: false)
54 : final String? foreignId;
55 :
56 : ///
57 : @JsonKey(includeIfNull: false)
58 : final DateTime? time;
59 :
60 : ///
61 : final Map<String, Object> set;
62 :
63 : ///
64 : final List<String> unset;
65 :
66 : /// Serialize to json
67 2 : Map<String, dynamic> toJson() => _$ActivityUpdateToJson(this);
68 :
69 1 : @override
70 1 : List<Object?> get props => [
71 1 : id,
72 1 : foreignId,
73 1 : time,
74 1 : set,
75 1 : unset,
76 : ];
77 : }
|