Skip to content

Commit 06c46d3

Browse files
jonasfjsigurdm
andauthored
Updated documentation comments (#226)
* Updated documentation comments * Update neat_periodic_task/lib/neat_periodic_task.dart Co-authored-by: Sigurd Meldgaard <[email protected]> --------- Co-authored-by: Sigurd Meldgaard <[email protected]>
1 parent 417b9f4 commit 06c46d3

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

neat_periodic_task/lib/neat_periodic_task.dart

+10-4
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class NeatPeriodicTaskScheduler {
115115
final Duration _minCycle;
116116
final Duration _maxCycle;
117117

118-
bool _running = false;
118+
bool _started = false;
119119
final _stopping = Completer<void>();
120120
final _stopped = Completer<void>();
121121

@@ -171,11 +171,15 @@ class NeatPeriodicTaskScheduler {
171171
}
172172

173173
/// Start the scheduler.
174+
///
175+
/// Once started a [NeatPeriodicTaskScheduler] cannot be restarted.
174176
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+
);
177181
}
178-
_running = true;
182+
_started = true;
179183

180184
_log.fine(() => 'NeatPeriodicTaskScheduler "$_name" STARTING');
181185
scheduleMicrotask(_loop);
@@ -186,6 +190,8 @@ class NeatPeriodicTaskScheduler {
186190
/// This returns a [Future] that is completed when the scheduler has finished
187191
/// any on-going iterations. This will not abort an ongoing task, but it will
188192
/// stop further iterations of the task.
193+
///
194+
/// Once stopped a [NeatPeriodicTaskScheduler] cannot be started again.
189195
Future<void> stop() async {
190196
if (!_stopping.isCompleted) {
191197
_stopping.complete();

0 commit comments

Comments
 (0)