saveTo method
Saves the file bytes to a local destination file path. Returns a new AdaptiveFile pointing to the saved destination.
Implementation
Future<AdaptiveFile> saveTo(String destinationPath) async {
if (kIsWeb) {
throw UnsupportedError('saveTo() filesystem is not supported on web platform.');
}
final rawBytes = await readAsBytes();
await io_helper.saveFileBytes(destinationPath, rawBytes);
return copyWith(
path: destinationPath,
name: _extractFileName(destinationPath),
size: rawBytes.lengthInBytes,
);
}