getFile method
Retrieves the content of the file at path
.
onProgress
can be used to watch the download progress. Possible values range from 0.0
to 1.0
.
If the response is empty the file will be created with no data.
See:
- get_Request for the request sent by this method.
Implementation
Future<void> getFile(
PathUri path,
File file, {
void Function(double progress)? onProgress,
}) async {
final sink = file.openWrite();
final stream = await getStream(
path,
onProgress: onProgress,
);
await stream.pipe(sink);
await sink.close();
}