uploadFile method

  1. @override
Future<String?> uploadFile(
  1. UploadTask task
)
override

Start a background upload task.

Returns the upload ID if successful, null otherwise.

Implementation

@override
Future<String?> uploadFile(UploadTask task) async {
  try {
    final result = await methodChannel.invokeMethod<String>(
      'uploadFile',
      task.toMap(),
    );
    return result;
  } on PlatformException catch (e) {
    debugPrint('Failed to start upload: ${e.message}');
    return null;
  }
}