i want to download image from firebase storage using the url.
here is my code
Future<void> _download(String _url) async {
print("START DOWNLOADDD");
final response = await http.get(Uri.parse(_url));
print("response done");
final imageName = path.basename(_url);
print(imageName);
final appDir = await path_provider.getApplicationDocumentsDirectory();
print(appDir);
final localPath = await path.join(appDir.path, imageName);
print(localPath);
final imageFile = File(localPath);
print("imageFile done");
await imageFile.writeAsBytes(response.bodyBytes);
print("download");
listDownloadPath.add(await localPath);
setState(() {});
print(await "END DOWNLOADDDD");
}
it works in android, but when i try it on chrome it get error when get the response.
is there any way that i can do to fix it? thank you