loadTopFlights method

void loadTopFlights()

Implementation

void loadTopFlights() async {
  try {
    var response = await Requests.getDio(highTimeout: true)
        .get("/booking/discounts/highest");
    if (response.statusCode == 200) {
      topFlights.value = BookingHistoryModel.fromJson(response.data);
    } else {
      final route = currentRoute();
      if (route == Routes.TOP_FLIGHTS) {
        CustomFlashWidget.showFlashMessage(
          type: FlashType.error,
          title: "Error",
          message: response.data["message"] ??
              'Error loading Club Memeber Latest Booked Flights',
        );
      }
      debugPrint("Error loading Top Flights ${response.data}");
    }
  } catch (e) {
    final route = currentRoute();
    if (route == Routes.TOP_FLIGHTS) {
      CustomFlashWidget.showFlashMessage(
        type: FlashType.error,
        title: "Error",
        message: 'Error loading Club Memeber Latest BookedFlights',
      );
    }
    debugPrint(
        "Error loading Club Memeber Latest Booked Flights ${e.toString()}");
  }
}