streamData method

Widget streamData({
  1. required Widget consumerFunc(
    1. List<Map<String, dynamic>> resultList
    ),
  2. required Map<String, dynamic> where,
  3. required String orderBy,
  4. bool descending = true,
  5. int? limit,
})

Implementation

Widget streamData({
  required Widget Function(List<Map<String, dynamic>> resultList) consumerFunc,
  required Map<String, dynamic> where,
  required String orderBy,
  bool descending = true,
  int? limit, // 페이지 크기
}) {
  return HycopFactory.dataBase!.streamData(
    collectionId: collectionId,
    consumerFunc: (List<Map<String, dynamic>> resultList) {
      modelList.clear();
      for (Map<String, dynamic> ele in resultList) {
        AbsExModel model = newModel(ele['mid'] ?? '');
        if (model.isRemoved.value == true) continue;
        model.fromMap(ele);
        modelList.add(model);
      }
      //notifyListeners();
      return consumerFunc(resultList);
    },
    where: where,
    orderBy: orderBy,
    descending: descending,
    limit: limit,
  );
}