start abstract method

FutureOr<void> start()

A common interface defining methods for start/stop lifecycle control.

The typical use case for this is to control asynchronous processing. This interface does not imply specific auto-startup semantics.

Usage Example

class BackgroundTaskManager implements Lifecycle {
  bool _running = false;

  @override
  void start() {
    if (!_running) {
      startBackgroundTasks();
      _running = true;
    }
  }

  @override
  void stop() {
    if (_running) {
      stopBackgroundTasks();
      _running = false;
    }
  }

  @override
  bool isRunning() => _running;
}

Start this component.

Should not throw an exception if the component is already running.

Implementation

FutureOr<void> start();