By using AWS re:Post, you agree to the Terms of Use

how to get _version in appsync graphql query on flutter application

0

Update mutation fails in appsync request from flutter application because _version is not passed along with it. I am not interested in using datastore yet, Kindly let me know how I can get the latest _version using my fetch query and pass it in my update mutation. *Note: I am able to get the _version in my fetch query on appsync console. But the query does not return _version in my flutter application.

I have tried below request methods, both does not return _version

final request = ModelQueries.get(VariableList.classType, "c80d6fb2-97ed-4194-8d80-d9cfe6125321");

<code>String someId = "c80d6fb2-97ed-4194-8d80-d9cfe6125321";
   const getVariableList = "getVariableList";
   String graphQLDocument = '''
  {getVariableList(id: "c80d6fb2-97ed-4194-8d80-d9cfe6125321") {
   CropType
    OrderStatus
    PaymentStatus
    _version
    id
    PaymentType
    StableVersion
  }}
''';
    final request = GraphQLRequest<VariableList>(
        document: graphQLDocument,
       modelType: VariableList.classType,
     variables: <String, String>{'id': someId},
    decodePath: getVariableList);

    final response = await Amplify.API.query(request: request).response;