File tree 1 file changed +10
-4
lines changed
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ class NeatPeriodicTaskScheduler {
115
115
final Duration _minCycle;
116
116
final Duration _maxCycle;
117
117
118
- bool _running = false ;
118
+ bool _started = false ;
119
119
final _stopping = Completer <void >();
120
120
final _stopped = Completer <void >();
121
121
@@ -171,11 +171,15 @@ class NeatPeriodicTaskScheduler {
171
171
}
172
172
173
173
/// Start the scheduler.
174
+ ///
175
+ /// Once started a [NeatPeriodicTaskScheduler] cannot be restarted.
174
176
void start () {
175
- if (_running) {
176
- throw StateError ('NeatPeriodicTaskScheduler for "$_name " is running' );
177
+ if (_started) {
178
+ throw StateError (
179
+ 'NeatPeriodicTaskScheduler for "$_name " has already been started' ,
180
+ );
177
181
}
178
- _running = true ;
182
+ _started = true ;
179
183
180
184
_log.fine (() => 'NeatPeriodicTaskScheduler "$_name " STARTING' );
181
185
scheduleMicrotask (_loop);
@@ -186,6 +190,8 @@ class NeatPeriodicTaskScheduler {
186
190
/// This returns a [Future] that is completed when the scheduler has finished
187
191
/// any on-going iterations. This will not abort an ongoing task, but it will
188
192
/// stop further iterations of the task.
193
+ ///
194
+ /// Once stopped a [NeatPeriodicTaskScheduler] cannot be started again.
189
195
Future <void > stop () async {
190
196
if (! _stopping.isCompleted) {
191
197
_stopping.complete ();
You can’t perform that action at this time.
0 commit comments