Tutorial

Set up fullstack project

👋 Welcome! In this tutorial, you will:

  • Setup your Flutter development environment
  • Add the Amplify Flutter Library dependencies
  • Create a basic app that records an analytics event
  • Use Amplify CLI to setup your AWS backend resources

Prerequisites

  • Install Flutter version 1.20.0 or higher (make sure you are using a stable version of flutter)

  • Setup your IDE

    This tutorial assumes you are using AndroidStudio to develop your app.

  • Install the Amplify CLI by running:

    npm install -g @aws-amplify/cli

    npm install -g @aws-amplify/cli

    Note: Because we’re installing the Amplify CLI globally, you might need to run the command above with sudo depending on your system policies.

    curl -sL https://aws-amplify.github.io/amplify-cli/install | bash && $SHELL

    curl -sL https://aws-amplify.github.io/amplify-cli/install | bash && $SHELL

    curl -sL https://aws-amplify.github.io/amplify-cli/install-win -o install.cmd && install.cmd

    curl -sL https://aws-amplify.github.io/amplify-cli/install-win -o install.cmd && install.cmd

  • Sign up for an AWS account

    If you don’t already have an AWS account, you’ll need to create one in order to follow the steps outlined in this tutorial.

    Create AWS Account

    There are no upfront charges or any term commitments to create an AWS account and signing up gives you immediate access to the AWS Free Tier.

Set up your application

Create a new Flutter application

  1. Create a new project using Flutter CLI:

    flutter create todo

    flutter create todo
  2. Or using Android Studio. Select + Start a new Flutter project.

  3. In Select a Project Template, select Flutter Application. Press Next.

  1. Next, configure your project:

    • Enter todo in the Name field
    • Make sure your Flutter SDK path is set correctly to where it is installed on your machine
    • Press Next. On the next screen, press Finish.

Android Studio will open your project with a tab opened to main.dart

  1. Modify your Podfile to target iOS platform 11.0 or higher. Within your project open ios/Podfile and change the second line to be `platform :ios, ‘11.0’.
  2. Modify your AndroidManifest.xml to target minSDK 21 or higher. Within your project open android/app/src/main/AndroidManifest.xml and change the line starting with minSdkVersion to be minSdkVersion 21.

You now have an empty Flutter project into which you’ll add Amplify in the next steps.

Add Amplify to your application

Amplify for Flutter is distributed via pub.dev.

  1. Open your app‘s pubspec.yaml and add the following 3 dependencies below the line “sdk:flutter”.

dependencies: flutter: sdk: flutter amplify_flutter: '<1.0.0' amplify_auth_cognito: '<1.0.0' amplify_analytics_pinpoint: '<1.0.0'

dependencies: flutter: sdk: flutter amplify_flutter: '<1.0.0' amplify_auth_cognito: '<1.0.0' amplify_analytics_pinpoint: '<1.0.0'
  1. Run Flutter Pub Get

    Android Studio requires you to sync your project with your new configuration. To do this, you can click Flutter in the notification bar above the file editor.

    Alternatively, you can open a terminal window, cd into your project’s root directory (where your pubspec.yaml is) and run:

    flutter pub get

    flutter pub get

    When complete, you will see Process finished with exit code 0 in the output of the Messages tab at the bottom of your screen.

You are ready to start building with Amplify! 🎉

Previous Page
previous

Prerequisites

next

Integrate in your app

Next Page
Discord Logo
Amplify open source, documentation and community are supported by Amazon Web Services © 2020, Amazon Web Services, Inc. and its affiliates. All rights reserved. View the site terms and privacy policy.
    Flutter and the related logo are trademarks of Google LLC. We are not endorsed by or affiliated with Google LLC.