aws-amplify / amplify-flutter

A declarative library with an easy-to-use interface for building Flutter applications on AWS.
https://docs.amplify.aws
Apache License 2.0
1.31k stars 243 forks source link

StorageUploadDataOptions can't be recognised and Amplify_datastore 1.1.1 #3177

Closed harrynguyen2510 closed 1 year ago

harrynguyen2510 commented 1 year ago

Hi everyone,

I have some issues about uploadFile function from Amplify Storage S3

First, environment:

Flutter version: 3.10.4 stable

Amplify plugins: pubspec.yaml

  amplify_flutter: ^0.6.13
  amplify_auth_cognito: ^0.6.13
  amplify_datastore: ^0.6.13
  amplify_core: ^0.6.13
  amplify_api: ^0.6.13
  amplify_storage_s3: ^0.6.13
  amplify_analytics_pinpoint: ^0.6.13

I tried to add version ^ 1.1.1 but amplify_datastore does not have yet, and met conflicts other libraries, so I decided to keep as 0.6.13

I want to to use Transfer Acceleration to improve speed when uploading file to S3 storage I uploaded two photos captured from iPhone, took 1 minutes 57 seconds to upload, Internet speed: 18.47 mbps for upload

Second, What I did:

export function override(resources: AmplifyS3ResourceTemplate, amplifyProjectInfo: AmplifyProjectInfo) { resources.s3Bucket.accelerateConfiguration = { accelerationStatus: 'Enabled' } }

Third, **Issue here:** when I tried to add options on Amplify.storage.uploadFile( ...)

options: const StorageUploadFileOptions( pluginOptions: S3UploadFilePluginOptions( useAccelerateEndpoint: true, ), ),


from: "https://docs.amplify.aws/lib/storage/transfer-acceleration/q/platform/flutter/#use-transfer-acceleration-on-storage-operations" 
Flutter and Amplify storage plugin can not regonize StorageUploadFileOptions class
It just recognised this one: 
`S3UploadFileOptions options = S3UploadFileOptions( ... ) `
What steps did I miss?

Thank you very much 
dnys1 commented 1 year ago

Hi @harrynguyen2510, can you please try the following dependencies:

dependencies:
  amplify_flutter: ^1.1.1
  amplify_auth_cognito: ^1.1.1
  amplify_datastore: ^1.1.0-supports-only-mobile+1
  amplify_api: ^1.1.1
  amplify_storage_s3: ^1.1.1
  amplify_analytics_pinpoint: ^1.1.1
harrynguyen2510 commented 1 year ago

@dnys1 Thank you very much, it works