stevevar
stevevar

Reputation: 175

Flutter, AmplifyStorageS3 plugin not added correctly

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 https://docs.amplify.aws/lib/storage/getting-started/q/platform/flutter/#provision-backend-storage

Amplify storage S3 is not imported correctly. I cleared cache and reinstalled all the pubs I deleted publock file and pub get all the files no luck I restarted vscode a couple of times no luck

I see the import says not used so AmplifyStorageS3 class is not exported from the package ackage:amplify_storage_s3/amplify_storage_s3.dart ???

enter image description here

Upvotes: 1

Views: 433

Answers (1)

Legend5366
Legend5366

Reputation: 461

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

Upvotes: 1

Related Questions