@@ -80,7 +80,6 @@ class StretchStats {
80
80
double leftStretchDuration;
81
81
double rightStretchDuration;
82
82
83
-
84
83
StretchStats (
85
84
{this .maxMainAngle = 0 ,
86
85
this .maxLeftAngle = 0 ,
@@ -150,13 +149,13 @@ class NeckStretch {
150
149
late bool _resting;
151
150
152
151
/// Holds the Timer that increments the current Duration
153
- var _restDurationTimer;
152
+ Timer ? _restDurationTimer;
154
153
155
154
/// Stores the rest duration of the current timer
156
155
late Duration _restDuration;
157
156
158
157
/// Stores the current active timer for state transition
159
- var _currentTimer;
158
+ Timer ? _currentTimer;
160
159
161
160
StretchSettings get settings => _settings;
162
161
@@ -183,8 +182,8 @@ class NeckStretch {
183
182
void stopStretching () {
184
183
_resting = false ;
185
184
_settings.state = NeckStretchState .noStretch;
186
- _currentTimer.cancel ();
187
- _restDurationTimer.cancel ();
185
+ _currentTimer? .cancel ();
186
+ _restDurationTimer? .cancel ();
188
187
_restDuration = Duration (seconds: 0 );
189
188
_viewModel.stopTracking ();
190
189
}
@@ -204,7 +203,7 @@ class NeckStretch {
204
203
/// If we don't restart the timer it results in a weird UI inconsistency
205
204
/// for displaying the _restDuration as then the restDuration is already
206
205
/// counted down when the next Timer hasn't started yet.
207
- _restDurationTimer.cancel ();
206
+ _restDurationTimer? .cancel ();
208
207
_startCountdown ();
209
208
_restDuration = _settings.restingTime;
210
209
_currentTimer = Timer (_settings.restingTime, () {
@@ -241,8 +240,8 @@ class NeckStretch {
241
240
return ;
242
241
case NeckStretchState .leftNeckStretch:
243
242
_settings.state = NeckStretchState .doneStretching;
244
- _currentTimer.cancel ();
245
- _restDurationTimer.cancel ();
243
+ _currentTimer? .cancel ();
244
+ _restDurationTimer? .cancel ();
246
245
_restDuration = Duration (seconds: 0 );
247
246
_viewModel.stopTracking ();
248
247
_openEarable.audioPlayer.jingle (2 );
0 commit comments