cancelTask method

  1. @override
Future<bool> cancelTask(
  1. String taskId
)
override

Cancels an ongoing transfer task.

Attempts to cancel the WorkManager task with the given ID.

taskId The ID of the task to cancel.

Returns true if the task was successfully cancelled, false otherwise.

Implementation

@override
Future<bool> cancelTask(String taskId) async {
  try {
    return await _channel.invokeMethod('cancelTask', {
          'task_id': taskId,
        }) ??
        false;
  } on PlatformException {
    return false;
  }
}