cancelTask method
Implementation
Future<void> cancelTask(dynamic key) async {
final task = _queueBox.get(key);
if (task == null) {
return;
}
if (task is! Map || task['scope'] != currentSession().key) {
throw StateError('Session owner unavailable');
}
_running[key]?.cancel('Queued action cancelled');
await _lock.synchronized(() => _queueBox.delete(key));
_publish();
}