exists<_Model extends RestModel> method
Future<bool>
exists<_Model extends RestModel>({
- Query? query,
- ModelRepository<
RestModel> ? 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 RestModel>({query, repository}) async {
final url = urlForModel<_Model>(query);
if (url == null) return false;
logger.fine('GET $url');
final resp = await client.get(Uri.parse(url), headers: headersForQuery(query));
return statusCodeIsSuccessful(resp.statusCode);
}