downloadFile
seems to work fine (there is no errors) but when readAsString
called content is empty.
Same code works in Android. What might be the difference causing this to happen in iOS?
Using getApplicationDocumentsDirectory
for directory doesn't make a difference.
final dir = await getTemporaryDirectory();
final key = 'foo/bar.txt';
final file = File('${dir.path}/$key');
await file.create(recursive: true);
final result = await Amplify.Storage.downloadFile(
key: key,
local: file,
);
print(await result.file.length()); // 0
print(await result.file.readAsString()); // ""
This was the bug in amplify-flutter. The fix is released in v0.6.8.