Line data Source code
1 : class Change<T> {
2 : /// Value before change
3 : final T $old;
4 :
5 : /// Value after change
6 : final T $new;
7 :
8 : final item;
9 :
10 : final ListChangeOp op;
11 :
12 : final int pos;
13 :
14 : final DateTime time;
15 : final int batch;
16 4 : Change(
17 : {this.$new,
18 : this.$old,
19 : this.batch,
20 : this.item,
21 : this.op,
22 : this.pos,
23 : DateTime time})
24 4 : : time = time ?? DateTime.now();
25 0 : String toString() => 'Change(new: ${$new}, old: ${$old})';
26 :
27 3 : Change.insert(
28 : {this.$new, this.$old, this.batch, this.item, this.pos, DateTime time})
29 : : op = ListChangeOp.add,
30 3 : time = time ?? new DateTime.now();
31 :
32 0 : Change.set(
33 : {this.$new, this.$old, this.batch, this.item, this.pos, DateTime time})
34 : : op = ListChangeOp.set,
35 0 : time = time ?? new DateTime.now();
36 :
37 0 : Change.remove(
38 : {this.$new, this.$old, this.batch, this.item, this.pos, DateTime time})
39 : : op = ListChangeOp.remove,
40 0 : time = time ?? new DateTime.now();
41 :
42 0 : Change.clear({this.$new, this.$old, this.batch, DateTime time})
43 : : op = ListChangeOp.clear,
44 : pos = null,
45 : item = null,
46 0 : time = time ?? new DateTime.now();
47 : }
48 :
49 : typedef bool Condition();
50 :
51 : typedef E ChildrenListComposer<S, E>(S value);
52 :
53 : /// Change operation
54 65 : enum ListChangeOp { add, remove, clear, set }
|