exists<_Model extends GraphqlModel> method
Future<bool>
exists<_Model extends GraphqlModel>({
- Query? query,
- ModelRepository<
GraphqlModel> ? repository,
Whether a model instance is present. null
is returned when existence is unknown.
The model instance is not hydrated in the function output; a bool
variant
(e.g. List<bool>
, Map<TModel, bool>
) should be returned.
Implementation
@override
Future<bool> exists<_Model extends GraphqlModel>({query, repository}) async {
final request = GraphqlRequest<_Model>(
action: QueryAction.get,
modelDictionary: modelDictionary,
query: query,
variableNamespace: variableNamespace,
).request;
if (request == null) return false;
await for (final resp in link.request(request)) {
return resp.data != null && (resp.errors?.isEmpty ?? true);
}
return false;
}