listInternal<T> method

Future<List<T>> listInternal<T>(
  1. String database, {
  2. Map? filter,
  3. Map? sort,
})

Fetch list with given parameters. this method working over partitions. it can work slower since in this case you need internet connection Return result not included nested object / list

Implementation

Future<List<T>> listInternal<T>(String database,
    {Map? filter, Map? sort}) async {
  assert(_partition.length != 0);

  Map<dynamic, dynamic> map = await _channel
      .invokeMethod(Action.internalObjects.name, <String, dynamic>{
    'database': database,
    'collection': T.toString(),
    'identity': _syncUser.identity,
    'appId': _appId,
    'partition': _partition,
    'filter': filter,
    'sort': sort,
    'limit': _limit,
  });

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

  List results = map["results"];
  return results.map<T>((map) => _creator().fromJson(map) as T).toList();
}