update<T extends Model> static method

GraphQLRequest<T> update<T extends Model>(
  1. T model, {
  2. QueryPredicate<Model>? where,
  3. String? apiName,
  4. APIAuthorizationType<AmplifyAuthProvider>? authorizationMode,
  5. Map<String, String>? headers,
})

Generates a request to update a model instance.

final todoWithNewName = someTodo.copyWith(name: 'new name');
final request = ModelMutations.update(todoWithNewName);

An optional where parameter can be supplied as a condition for the update to be evaluated on the server.

Implementation

static GraphQLRequest<T> update<T extends Model>(
  T model, {
  QueryPredicate? where,
  String? apiName,
  APIAuthorizationType? authorizationMode,
  Map<String, String>? headers,
}) {
  return ModelMutationsFactory.instance.update<T>(
    model,
    where: where,
    apiName: apiName,
    authorizationMode: authorizationMode,
    headers: headers,
  );
}