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;
preguntada hace 2 años230 visualizaciones
1 Respuesta
0

Hello, were you able to get the _version field?

futican
respondido hace un año

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas