flutter_amplify_datastore_demo
使用 Amplify DataStore 在 Flutter 中克隆 WhatsApp

关于项目

内置
入门
要本地运行并启动一个副本,请按照以下简单步骤操作。
先决条件
- 您的系统中应已安装 Flutter。
- 需要 AWS 账户来配置所有资源。
- 应已安装 AWS Amplify CLI 并与 AWS 账户配置好。
安装
-
克隆仓库
git clone https://github.com/GeekyAnts/flutter_amplify_datastore_demo -
安装 NPM 包
flutter pub get -
运行 Amplify init 来初始化 Amplify 项目和应用 API 以配置资源
amplify init amplify add api amplify add auth // Choose email and password authentication. -
将
amplify/backend/api/FlutterAmplifyApi/schema.graphql文件中的 GraphQL schema 替换为以下内容。type ChatRoom @model @auth(rules: [{ allow: public }]) @key(name: "byUser", fields: ["userID"]) { id: ID! otherUserId: String otherUserName: String userID: ID chatId: String untitledfield: String } type ChatData @model @auth(rules: [{ allow: public }]) { id: ID! message: String createdAt: AWSDateTime chatRoomId: String senderId: String } type User @model @auth(rules: [{ allow: public }]) { id: ID! username: String! email: String bio: String profileImage: String isVerified: Boolean createdAt: AWSDateTime chats: AWSJSON ChatRooms: [ChatRoom] @connection(keyName: "byUser", fields: ["id"]) }
贡献
贡献是开源社区如此美好、激发灵感和创造的源泉。您的任何贡献都备受赞赏。
- Fork 该项目
- 创建您的功能分支(
git checkout -b feature/flutter_amplify_datastore_demo) - 提交您的更改(
git commit -m 'Add some flutter_amplify_datastore_demo') - 推送到分支(
git push origin feature/flutter_amplify_datastore_demo) - 打开一个拉取请求