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;
1개 답변
0

Hello, were you able to get the _version field?

futican
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠