ResponseModel.fromJson constructor

ResponseModel.fromJson(
  1. Map<String, dynamic> json, {
  2. required String valueFindKey,
  3. required String idFindKey,
})

Implementation

factory ResponseModel.fromJson(Map<String, dynamic> json,
    {required String valueFindKey, required String idFindKey}) {
  List<dynamic> responseList =
      json.containsKey('content') ? json['content'] : [];
  return ResponseModel(
    content: responseList
        .map((e) => CustomDropDownModel.fromJson(e,
            idFindKey: idFindKey, valueFindKey: valueFindKey))
        .toList(),
    totalPages: json.containsKey('totalPages') ? json['totalPages'] : 0,
  );
}