Skip to content

Offline-first Flutter app with Amplify Auth, DataStore and GoRouter

Notifications You must be signed in to change notification settings

stabildev/flutter_amplify_datastore

Repository files navigation

Offline-first Flutter app with Amplify Auth, DataStore and GoRouter

To see the full tutorial from scratch, click here

minSdkVersion 24 deploymentTarget 13.0

Prerequisites

Steps

  1. Run flutter pub get to install dependencies
  2. Run amplify init to initialize the Amplify project
  • Confirm the default values for all questions
  1. 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 select Auto 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
}
  1. Run amplify codegen models to generate models
  2. Run amplify add auth to add authentication
  • Select Email as the sign-in method
  1. Run amplify push to provision the backend
  2. Run flutter run to start the app

About

Offline-first Flutter app with Amplify Auth, DataStore and GoRouter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published