onStart method

  1. @override
Future<bool> onStart()
override

Callback when this executor is started. Returns true if successfully started, false otherwise.

Implementation

@override
Future<bool> onStart() async {
  // when an app task is started, create a new UserTask by adding it to the queue
  UserTask? userTask = await AppTaskController().enqueue(this);

  // automatically stop this executor again to be reused later
  // issue => https://github.com/cph-cachet/carp.sensing-flutter/issues/429
  Future.delayed(const Duration(seconds: 5), () => stop());

  return userTask != null;
}