statisticsQuery static method
Returns Statistics
for the provided type
and the,
the preferred unit
and the time interval predicate predicate
.
Warning: The unit
should be valid. See preferredUnits.
Implementation
static Future<Statistics> statisticsQuery(
QuantityType type, String unit, Predicate predicate) async {
final arguments = <String, dynamic>{
'identifier': type.identifier,
'unit': unit,
};
arguments.addAll(predicate.map);
final result =
await _methodChannel.invokeMethod('statisticsQuery', arguments);
final Map<String, dynamic> map = jsonDecode(result);
final statistics = Statistics.fromJson(map);
return statistics;
}