downloadStorage method

Future<void> downloadStorage({
  1. required String uuid,
  2. required File file,
})

下載檔案儲存至指定路徑

Implementation

Future<void> downloadStorage(
    {required String uuid, required File file}) async {
  if (Util.isWeb) {
    throw Exception('Not support StorageResource#downloadStorage on web');
  } else {
    if (!await file.exists()) {
      // 如果檔案不存在則建立
      await file.create(recursive: true);
    }
    Uint8List bytes = await getStorageBytes(uuid);
    await file.writeAsBytes(bytes);
  }
}