categoryQuery static method

Future<List<Category>> categoryQuery(
  1. CategoryType type,
  2. Predicate predicate
)

Returns Category samples for the provided type and the time interval predicate predicate.

Implementation

static Future<List<Category>> categoryQuery(
    CategoryType type, Predicate predicate) async {
  final arguments = <String, dynamic>{
    'identifier': type.identifier,
  };
  arguments.addAll(predicate.map);
  final result =
      await _methodChannel.invokeMethod('categoryQuery', arguments);
  final List<dynamic> list = jsonDecode(result);
  final categories = <Category>[];
  for (final Map<String, dynamic> map in list) {
    final category = Category.fromJson(map);
    categories.add(category);
  }
  return categories;
}