cancelBackgroundTask method

Future<void> cancelBackgroundTask(
  1. String taskId
)

Cancel a scheduled background task

Implementation

Future<void> cancelBackgroundTask(String taskId) async {
  try {
    await methodChannel
        .invokeMethod<void>('cancelBackgroundTask', {'taskId': taskId});
  } on PlatformException catch (e) {
    throw MCPBackgroundExecutionException(
        'Failed to cancel task: ${e.message}', e.details);
  }
}