fetchAllReports method

Future<List<ReportTypeModel>> fetchAllReports()

Implementation

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