flutter_amplify_datastore_demo

使用 Amplify DataStore 在 Flutter 中克隆 WhatsApp

demo--5-

关于项目

title_image

内置

入门

要本地运行并启动一个副本,请按照以下简单步骤操作。

先决条件

  • 您的系统中应已安装 Flutter。
  • 需要 AWS 账户来配置所有资源。
  • 应已安装 AWS Amplify CLI 并与 AWS 账户配置好。

安装

  1. 克隆仓库

    git clone https://github.com/GeekyAnts/flutter_amplify_datastore_demo
    
  2. 安装 NPM 包

    flutter pub get
    
  3. 运行 Amplify init 来初始化 Amplify 项目和应用 API 以配置资源

    amplify init
    amplify add api
    amplify add auth
    // Choose email and password authentication.
    
  4. 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"])
    }
    

贡献

贡献是开源社区如此美好、激发灵感和创造的源泉。您的任何贡献都备受赞赏

  1. Fork 该项目
  2. 创建您的功能分支(git checkout -b feature/flutter_amplify_datastore_demo
  3. 提交您的更改(git commit -m 'Add some flutter_amplify_datastore_demo'
  4. 推送到分支(git push origin feature/flutter_amplify_datastore_demo
  5. 打开一个拉取请求

GitHub

https://github.com/GeekyAnts/flutter_amplify_datastore_demo