@@ -27,13 +27,38 @@ extension EasingTypeExtension on EasingType {
2727 case EasingType .linear:
2828 return SizedBox (
2929 width: 65 ,
30- child: Sparkline (data: const [0 , 1 ], lineColor: Theme .of (context).colorScheme.outline, lineWidth: 5 ),
30+ child: Sparkline (
31+ data: const [0 , 1 ],
32+ lineColor: Theme .of (context).colorScheme.outline,
33+ lineWidth: 5 ,
34+ ),
3135 );
3236 case EasingType .cubic:
3337 return SizedBox (
3438 width: 65 ,
3539 child: Sparkline (
36- data: const [0.271 , 0.488 , 0.657 , 0.784 , 0.875 , 0.936 , 0.973 , 0.992 , 0.999 , 1 , 1.001 , 1.008 , 1.027 , 1.064 , 1.125 , 1.216 , 1.343 , 1.512 , 1.729 , 2 ],
40+ data: const [
41+ 0.271 ,
42+ 0.488 ,
43+ 0.657 ,
44+ 0.784 ,
45+ 0.875 ,
46+ 0.936 ,
47+ 0.973 ,
48+ 0.992 ,
49+ 0.999 ,
50+ 1 ,
51+ 1.001 ,
52+ 1.008 ,
53+ 1.027 ,
54+ 1.064 ,
55+ 1.125 ,
56+ 1.216 ,
57+ 1.343 ,
58+ 1.512 ,
59+ 1.729 ,
60+ 2 ,
61+ ],
3762 lineColor: Theme .of (context).colorScheme.outline,
3863 lineWidth: 5 ,
3964 ),
@@ -98,7 +123,13 @@ class Move {
98123
99124 Move ();
100125
101- Move .move ({this .leftServo = 0 , this .rightServo = 0 , this .speed = 50 , this .easingType = EasingType .linear, this .moveType = MoveType .move});
126+ Move .move ({
127+ this .leftServo = 0 ,
128+ this .rightServo = 0 ,
129+ this .speed = 50 ,
130+ this .easingType = EasingType .linear,
131+ this .moveType = MoveType .move,
132+ });
102133
103134 Move .delay (this .time) {
104135 moveType = MoveType .delay;
@@ -133,11 +164,18 @@ class Move {
133164 moveType == other.moveType;
134165
135166 @override
136- int get hashCode => leftServo.hashCode ^ rightServo.hashCode ^ speed.hashCode ^ time.hashCode ^ easingType.hashCode ^ moveType.hashCode;
167+ int get hashCode =>
168+ leftServo.hashCode ^
169+ rightServo.hashCode ^
170+ speed.hashCode ^
171+ time.hashCode ^
172+ easingType.hashCode ^
173+ moveType.hashCode;
137174}
138175
139176class MoveLists with ChangeNotifier {
140177 BuiltList <MoveList > _state = BuiltList ();
178+
141179 BuiltList <MoveList > get state => _state;
142180
143181 static final MoveLists instance = MoveLists ._internal ();
@@ -150,10 +188,11 @@ class MoveLists with ChangeNotifier {
150188 void reload () {
151189 List <MoveList > results = [];
152190 try {
153- results = HiveProxy . getAll <MoveList >(sequencesBox).toList (growable : true );
191+ results = Hive . box <MoveList >(sequencesBox).values. toList ();
154192 } catch (e, s) {
155193 sequencesLogger.severe ("Unable to load sequences: $e " , e, s);
156194 }
195+ Hive .box <MoveList >(sequencesBox).close ();
157196 _state = results.toBuiltList ();
158197 }
159198
@@ -179,8 +218,9 @@ class MoveLists with ChangeNotifier {
179218
180219 Future <void > store () async {
181220 sequencesLogger.info ("Storing sequences" );
182- await HiveProxy .clear <MoveList >(sequencesBox);
183- await HiveProxy .addAll <MoveList >(sequencesBox, _state);
221+ LazyBox <MoveList > lazyBox = await Hive .openLazyBox <MoveList >(sequencesBox);
222+ await lazyBox.clear ();
223+ await lazyBox.addAll (_state);
184224 notifyListeners ();
185225 }
186226}
0 commit comments