Whenever I try to upload an image to my s3 bucket created in flutter nothing happens.
final pickedFile = await picker.getImage(source: ImageSource.gallery);
try{
setState(() {
if (pickedFile != null) {
_image = File(pickedFile.path);
} else {
print('No image selected.');
}
});
print("here");
final key = new DateTime.now().toString();
print(key);
Map<String, String> metadata = <String, String>{};
metadata['name'] = 'filename';
metadata['desc'] = 'A test file';
S3UploadFileOptions options = S3UploadFileOptions(accessLevel: StorageAccessLevel.private, metadata: metadata);
try {
UploadFileResult result = await Amplify.Storage.uploadFile(
key: key,
local: _image,
options: options
);
print("Uploaded");
} on StorageException catch (e) {
print(e.message);
}
}catch (e){
Alert(
context: context,
type: AlertType.error,
desc: "Error Uploading File: " + e.toString());
}
}
I I've found this discussion on the topic https://github.com/aws-amplify/amplify-android/discussions/550 however I don't have a amplifyconfiguration.json file I have it in .dart form. Also all of my information is present. I'm not sure why I'm not able to upload to s3. Thank you in advance!