getDesignList method

Future<List<DesignModel>> getDesignList(
  1. RoomModel model,
  2. StationData station, {
  3. dynamic callback(
    1. List<DesignModel> res
    )?,
})

Implementation

Future<List<DesignModel>> getDesignList(RoomModel model, StationData station,
    {Function(List<DesignModel> res)? callback}) async {
  Map<String, dynamic> param = {
    'roomTaskId': model.id,
    'actualOrder': station.actualOrder
  };
  Map? res = await UnitsForNetwork.getHttp(designListApi, parameters: param);
  List<DesignModel> modelList = [];
  if (res != null) {
    List resList = res["data"];

    if (resList.isNotEmpty) {
      for (var element in resList) {
        DesignModel designModel = DesignModel.fromJson(element);
        modelList.add(designModel);
      }
    }
  }
  if (callback != null) {
    callback(modelList);
  }
  return modelList;
}