BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Amplify Flutter Brings Together Flutter and AWS for Cross-Platform Apps

Amplify Flutter Brings Together Flutter and AWS for Cross-Platform Apps

This item in japanese

Amplify Flutter aims to simplify the creation of cross-platform apps for iOS, Android, and the Web using Google Flutter UI toolkit and AWS. Announced as a developer preview last August, Amplify Flutter is now generally available and includes new Data, API, and Auth capabilities.

Amplify is designed for developers who have invested in the Flutter ecosystem and now want to take advantage of the power of AWS. You can use the Amplify Flutter libraries with Amplify-created backends, as well as existing AWS backends.

Flutter is a toolkit based on Flutter aimed to creating Web and mobile apps from a single codebase.

Amplify for iOS and Android provide native libraries aimed at specific use-cases, including authentication, data storage and access, machine learning and so on. Those act as a wrapper around the lower-level AWS Mobile SDKs and offer a declarative API to make those tasks easier.

Amplify Flutter is designed as a collection of plugins to allow for extensibility, says Amazon. It includes support for authentication, storage, and analytics. Amplify Auth category provides an interface to authenticate users and is able to provide authorization for the other categories. The DataStore category aims to provide a unified model for shared and distributed data in both online and offline mode. The Storage category provides support for managing user content in public, protected, or private storage buckets.

The following code snippet shows how you can upload a file to S3 using Amplify Flutter's Storage.uploadFile API:

try {
  File local = await FilePicker.getFile(type: FileType.image);
  final key = 'myKey';

  S3UploadFileOptions options = S3UploadFileOptions(
      accessLevel: StorageAccessLevel.protected);

  UploadFileResult result = await Amplify.Storage.uploadFile(
      key: key, local: local, options: options);

  setState(() {
    _uploadFileResult = result.key;
  });
} catch (error) {
  print(error);
}

As mentioned, with the GA announcement, Amazon added new features to Amplify Flutter, including support for GraphQL and REST, and authentication with Hosted UI, a customizable OAuth 2.0 flow that enables launching a login screen without embedding the corresponding third-party SDK, such as Facebook's, Google's, or Amazon's.

Using Amplify Flutter does not imply any additional cost besides what you pay for the backend services above the free tier.

Rate this Article

Adoption
Style

BT