import 'package:cheminova/models/place_order_list_model.dart'; // Import your model import '../utils/common_api_service.dart'; import '../utils/show_snackbar.dart'; class GetSingleOrderPlacedService { Future getSinglePlacedOrder(String orderId) async { try { // Construct the API URL for the single placed order String url = "/api/get-single-placed-order-pd/$orderId"; final response = await commonApiService( method: "GET", url: url, fromJson: (json) { if (json['singleOrder'] != null) { // Convert the JSON response to a PlacedOrderList model return PlacedOrderList.fromJson(json['singleOrder'] as Map); } else { throw Exception("Order not found"); // Throw an exception if not found } }, ); return response; } catch (e) { showSnackbar(e.toString()); return null; } } }