get<T extends Model> static method

GraphQLRequest<T> get<T extends Model>(
  1. ModelType<T> modelType,
  2. ModelIdentifier<T> modelIdentifier, {
  3. String? apiName,
  4. APIAuthorizationType<AmplifyAuthProvider>? authorizationMode,
  5. Map<String, String>? headers,
})

Generates a request for a single instance of the modelType by ModelIdentifier.

final request = ModelQueries.get(
  Todo.classType,
  TodoModelIdentifier(id: 'some-todo-id-123'),
);

Implementation

static GraphQLRequest<T> get<T extends Model>(
  ModelType<T> modelType,
  ModelIdentifier<T> modelIdentifier, {
  String? apiName,
  APIAuthorizationType? authorizationMode,
  Map<String, String>? headers,
}) {
  return ModelQueriesFactory.instance.get<T>(
    modelType,
    modelIdentifier,
    apiName: apiName,
    authorizationMode: authorizationMode,
    headers: headers,
  );
}