fetchSubReport method

Future<List<ReportSubTypeModel>> fetchSubReport(
  1. dynamic reportTypeId
)

Implementation

Future<List<ReportSubTypeModel>> fetchSubReport(reportTypeId) {
  return _httpService.fetchSubReport(reportTypeId).then((data) async {
    if (data.statusCode == 200) {
      List<dynamic> reports = json.decode(data.body);
      List<ReportSubTypeModel> reportsSubTypeList =
          reports.map((i) => ReportSubTypeModel.fromJson(i)).toList();
      return reportsSubTypeList;
    } else {
      return List<ReportSubTypeModel>.from([]);
    }
  });
}