onDispose method
Callback when this executor is disposed.
Subclasses should override this, to implement any cleanup to be done before disposing.
Implementation
@override
Future<void> onDispose() async {
// A study re-added with the same deployment id must get fresh executors.
if (configuration != null) ExecutorFactory().remove(configuration!.studyDeploymentId);
await super.onDispose();
// remove the executors from the device managers
for (var element in executors) {
TaskControlExecutor executor = element as TaskControlExecutor;
getDeviceManagerFromRoleName(executor.taskControl.destinationDeviceRoleName)?.executors.remove(executor);
}
}