onInitialize method

  1. @override
bool onInitialize()
override

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

Note that this is a non-async method and should hence be 'light-weight' and not block execution for a long duration.

Implementation

@override
bool onInitialize() {
  AppTaskController().userTaskEvents.listen((userTask) {
    if (userTask.state == UserTaskState.done) {
      // add the completed task measurement to the measurements stream
      _controller.add(Measurement.fromData(
          CompletedTask(taskName: userTask.name, taskData: userTask.result)));
    }
  });

  return super.onInitialize();
}