count method
The number of data points matching the query
for this deployment.
A query
using REST SQL (RSQL)
can be provided.
Implementation
Future<int> count([String query = '']) async {
String url = (query.isEmpty)
? "$dataEndpointUri/count"
: "$dataEndpointUri/count?query=$query";
http.Response response = await httpr.get(url, headers: headers);
int httpStatusCode = response.statusCode;
if (httpStatusCode == HttpStatus.ok) {
return int.tryParse(response.body) ?? 0;
}
// All other cases are treated as an error.
Map<String, dynamic> responseJson =
json.decode(response.body) as Map<String, dynamic>;
throw CarpServiceException.fromMap(httpStatusCode, responseJson);
}