I am using google_apis v3 to upload a file to drive. How can I get the progress percentage of uploading status through the Google Drive API library? And also how can I cancel the uploading file?
The sample source code is as below.
Future<File> uploadFile(
GoogleAuthClient googleAuthClient, FileUpload fileUpload) async {
final DriveApi driveApi = driveDataProvider.getDriveApi(googleAuthClient);
final Stream<List<int>> mediaStream =
Future.value(fileUpload.data).asStream().asBroadcastStream();
Media media = Media(mediaStream, fileUpload.size);
File createdFile = await driveApi.files.create(fileUpload.file,
uploadMedia: media, uploadOptions: UploadOptions.resumable;);
return createdFile;
}