graphql中的问题

时间:2019-06-21 11:55:06

标签: flutter

请看一下我正在使用graphql软件包实现后端的"graphql_flutter",但在插入和更新数据时遇到了突变问题。
 给定的代码没有错误,也没有数据进入结果。所以建议我任何解决方法。

Widget btnNext() {
    String addUser = """
  mutation {
    createUser(input: { phone: "+918005091071",           
    password: "k8sllc",
    verificationCode: "591035"}) {
     user {
      name
      id
      email
      phone
      status
      createdAt
      updatedAt
      password
    }
    }
  }
""";
    return Mutation(
      options: MutationOptions(
        document: addUser, // this is the mutation string you just created
      ),
      builder: (
        RunMutation runMutation,
        QueryResult result,
      ) {
        return Container(
          width: _screenSize.width,
          margin: EdgeInsets.only(
            top: 20.0,
          ),
          child: ButtonTheme(
            minWidth: double.maxFinite,
            height: 45.0,
            child: RaisedButton(
                color: Colors.grey,
                onPressed: () => runMutation({
                      "phone": "+918000091071",
                      "password": "k8sllc",
                      "verificationCode": "591035"
                    }),
                child: AppSpecificStyle.getNextText(
                    AppLocalizations.of(context).translate('Next'))),
          ),
        );

      },
      update: (Cache cache, QueryResult result) {
        return cache;
      },
      onCompleted: (dynamic resultData) {
        print("$resultData");
      },
    );
}

0 个答案:

没有答案