fetch method

Future<LCObject> fetch({
  1. Iterable<String>? keys,
  2. Iterable<String>? includes,
})

Fetches the object from the cloud.

Can also specifies which keys to fetch, and if this includes pointed objects.

Implementation

Future<LCObject> fetch(
    {Iterable<String>? keys, Iterable<String>? includes}) async {
  Map<String, dynamic> queryParams = {};
  if (keys != null) {
    queryParams['keys'] = keys.join(',');
  }
  if (includes != null) {
    queryParams['include'] = includes.join(',');
  }
  String path = 'classes/$className/$objectId';
  Map<String, dynamic> response =
      await LeanCloud._httpClient.get(path, queryParams: queryParams);
  _LCObjectData objectData = _LCObjectData.decode(response);
  _merge(objectData);
  return this;
}