count method

Future<int?> count()

Get query result count

Implementation

Future<int?> count() async {
  assert(_partition.length != 0);

  LinkedHashMap<dynamic, dynamic> map =
      await _channel.invokeMethod(Action.count.name, <String, dynamic>{
    'query': query,
    'limit': _limit,
    'sorted': _sorted == null ? null : _sorted!.sortArray(),
    'type': T.toString(),
    'identity': _syncUser.identity,
    'appId': _appId,
    'partition': _partition,
  });

  if (map["error"] != null) {
    throw Exception("fetch list finished with exception ${map["error"]}");
  }

  int? count = map["count"];
  return count;
}