Closed MichelMelhem closed 5 years ago
It's fully possible that there is a bug here, but you should start by writing the stream to disk correctly.
Afaik, you cannot away in the .listen
callback.
try something like:
final writer = File('$filename').openWrite();
await data.stream(writer);
await writer.close();
When i do like this :
final plansDir = new Directory(
'${workSiteBloc.currentState.workSites[event.index].path}/plans');
yield currentState.copyWith(isFetching: true);
drive.Media data = await GApiRepo().downloadPlan(event.id);
plansDir.create();
final file = new File('${plansDir.path}/${event.filename}').openWrite();
data.stream(file);
file.close();
yield currentState.copyWith(isFetching: false);
workSiteBloc.addPlan(event.index, event.id, event.filename, file.path);
I get this error :
I fix my issue doing things like this :
drive.Media data = await GApiRepo().downloadPlan(event.id);
plansDir.create();
final file = new File('${plansDir.path}/${event.filename}');
final writer = File('${file.path}').openWrite();
await writer.addStream(data.stream);
await writer.close();
Thnak you for your help ^^
我通过这样做来解决我的问题:
drive.Media data = await GApiRepo().downloadPlan(event.id); plansDir.create(); final file = new File('${plansDir.path}/${event.filename}'); final writer = File('${file.path}').openWrite(); await writer.addStream(data.stream); await writer.close();
谢谢你的帮助^^
你好,如何监听下载进度 progress
Hello, When i download a media with the
get(fileId)
method i have a problem, They are all corrupted when i try to read the file i downloaded previously. I first get the media from google drive, And them i write the media with writeAsByte on the local system with this code :I use an authenthicate OAuth 2.0 client. It is a big issue beacause i can't download any Media from google drive. When i list files on google drive it work perfectly so my client is well authenticate.
This is the function that download the Meida from google drive :
Thank you, Michel M
I'm using: Flutter : 1.5.4-hotfix.2 googleapis: ^0.53.0