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