'how to get _version in appsync graphql query on flutter application
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. I have tried below request methods, both does not return _version
1)
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;
I tried in appsync console, i am able to get the _Version in my query response and i am able to add the _Version to my update mutation and update the item in dynamodb. But I do not get the same _Version response in my flutter application.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
