deleteAll method Null safety

Future deleteAll(
  1. List<LCObject> objectList
)

Delete all objects in objectList.

Implementation

static Future deleteAll(List<LCObject> objectList) async {
  if (objectList.length == 0) {
    return;
  }
  Set<LCObject> objects = objectList.where((item) {
    return item.objectId != null;
  }).toSet();
  List requestList = objects.map((item) {
    String path = '/$APIVersion/classes/${item.className}/${item.objectId}';
    return {'path': path, 'method': 'DELETE'};
  }).toList();

  // 发送请求
  Map<String, dynamic> data = {
    'requests': _LCEncoder.encodeList(requestList)
  };
  await LeanCloud._httpClient.post('batch', data: data);
}