To see the full tutorial from scratch, click here
minSdkVersion 24 deploymentTarget 13.0
- Set up Flutter and the Amplify CLI (follow the Project setup guide)
- Run
flutter pub get
to install dependencies - Run
amplify init
to initialize the Amplify project
- Confirm the default values for all questions
- Run
amplify add api
to add a GraphQL API
- Select
GraphQL
as the API type - Select
Amazon Cognito User Pool
as the authentication type - Enable
conflict detection
and selectAuto Merge
as the resolution strategy - Select
Blank schema
as the schema template - Replace the contents of
amplify/backend/api/flutter_amplify_datastore/schema.graphql
with the following schema:
type Workout @model @auth(rules: [{ allow: owner }]) {
id: ID!
owner: String @auth(rules: [{ allow: owner, operations: [read, delete] }])
createdAt: AWSDateTime!
startedAt: AWSDateTime
finishedAt: AWSDateTime
}
- Run
amplify codegen models
to generate models - Run
amplify add auth
to add authentication
- Select
Email
as the sign-in method
- Run
amplify push
to provision the backend - Run
flutter run
to start the app