Flutter Amplify ToDo 演示应用
此演示项目展示了如何使用 AWS Amplify 和 Flutter 创建一个无服务器的 ToDo 应用。
入门
注意:除非另有说明,否则请在项目根文件夹中执行命令。
先决条件
安装以下工具
AWS 账户(如果您还没有)
配置 Amplify CLI
- 通过
npm install -g @aws-amplify/cli安装 CLI - 通过
amplify configure使用您的 AWS 配置文件配置 CLI - 在当前项目中通过
amplify init初始化 Amplify(使用上一步配置的 AWS 配置文件)
配置 Amplify 认证
使用以下配置执行 amplify add auth
Do you want to use the default authentication and security configuration?
Default configuration
How do you want users to be able to sign in?
Username
Do you want to configure advanced settings?
No, I am done.
使用 amplify push 推送您的更改。
配置 Amplify DataStore
使用以下配置执行 amplify add api
Select from one of the below mentioned services:
GraphQL
Here is the GraphQL API that we will create. Select a setting to edit or continue (Use arrow keys)
Name: flutteramplifytodo
Authorization modes: API key (default, expiration time: 365 days from now)
Conflict detection (required for DataStore): Enabled
Conflict resolution strategy: Auto Merge
Choose a schema template:
Single object with fields (e.g., “Todo” with ID, name, description)
使用 amplify push 推送您的更改。