get method

Future<List<QBCustomObject?>> get(
  1. String className, {
  2. QBSort? sort,
  3. QBFilter? filter,
  4. int limit = 100,
  5. int skip = 0,
  6. List<String>? exclude,
  7. List<String>? include,
})

Implementation

Future<List<QBCustomObject?>> get(String className,
    {QBSort? sort,
    QBFilter? filter,
    int limit = 100,
    int skip = 0,
    List<String>? exclude,
    List<String>? include}) async {
  Map<String, Object> data = Map();

  data["className"] = className;
  data["limit"] = limit;
  data["skip"] = skip;

  if (sort != null) {
    data["sort"] = QBSortMapper.sortToMap(sort)!;
  }
  if (filter != null) {
    data["filter"] = QBFilterMapper.filterToMap(filter)!;
  }

  if (include != null) {
    data["include"] = include;
  }
  if (exclude != null) {
    data["exclude"] = exclude;
  }

  List<Object?> list = await _customObjectsModule.invokeMethod(GET_METHOD, data);

  List<QBCustomObject?> customObjects = [];

  for (final item in list) {
    QBCustomObject? customObject = QBCustomObjectMapper.mapToQBCustomObject(item as Map<dynamic, dynamic>);
    customObjects.add(customObject);
  }

  return customObjects;
}