Home > Enterprise >  Flutter, AmplifyStorageS3 plugin not added correctly
Flutter, AmplifyStorageS3 plugin not added correctly

Time:03-31

enter image description here

getting

Error :

/*
dynamic AmplifyStorageS3()
package:my_budget_app/main.dart

AmplifyStorageS3 isn't a type.
Try correcting the name to match an existing type
*/

I am following this docs enter image description here

CodePudding user response:

I have 3 ideas.
1: In package import import 'package:amplify_storage_s3/amplify_storage_s3.dart'; add "as ampl" to the end and then you will have something like this:

import 'package:amplify_storage_s3/amplify_storage_s3.dart' as ampl;

And then write:

ampl.AmplifyStorageS3 storage = ampl.AmplifyStorageS3();

2: Hold ctrl and left click on the imported package, find this class in the package and find out what's wrong.

3: Check your pubspec.yaml and so on for minimum requirements:

environment:
  sdk: ">=2.12.0 <3.0.0"

enter image description here

  • Related