searchObject<T extends VasatModel<T>> method

Future<List<T>> searchObject<T extends VasatModel<T>>(
  1. VasatFromJsonFactory<T> factory, {
  2. Map<String, String>? params,
  3. bool updateTimestamp = false,
})

////////////////////////////////////// Search and Sync Methods ////////////////////////////////////////////////////

Implementation

Future<List<T>> searchObject<T extends VasatModel<T>>( VasatFromJsonFactory<T> factory, {Map<String, String>? params, bool updateTimestamp = false} ) {
  // Get the vasat object name from the factory. We simply create an empty object to call the getObjectName().
  var vasatObjectName = factory({}).getObjectName();
  // init params if not passed
  if (params == null) params = {};
  // if we don't pass limit in params use the default value
  if (!params.containsKey("limit")) params["limit"] = config.queryLimit.toString();
  String url = getUrlRoot(vasatObjectName);
  return apiGet(url, params: params, returnPayloadOnly: false).then((res) {
    return processObjects<T>(res, factory, updateTimestamp: updateTimestamp);
  });

}