import 'package:dio/dio.dart'; class InvoiceService { final Dio dio; InvoiceService(this.dio); // ------------------------------------------------------- // ⭐ GET ALL INVOICES // ------------------------------------------------------- Future> getAllInvoices() async { try { final res = await dio.get("/user/invoices"); print("🔵 ALL INVOICES RESPONSE:"); print(res.data); return Map.from(res.data); } catch (e) { print("❌ ERROR (All Invoices): $e"); return {"success": false, "message": e.toString()}; } } // ------------------------------------------------------- // ⭐ GET INSTALLMENTS // ------------------------------------------------------- Future> getInstallments(int invoiceId) async { try { final res = await dio.get("/user/invoice/$invoiceId/installments"); print("🔵 INSTALLMENTS RESPONSE:"); print(res.data); return Map.from(res.data); } catch (e) { print("❌ ERROR (Installments): $e"); return {"success": false, "message": e.toString()}; } } // ------------------------------------------------------- // ⭐ GET FULL INVOICE DETAILS (PRINT JSON HERE) // ------------------------------------------------------- Future> getInvoiceDetails(int invoiceId) async { try { final res = await dio.get("/user/invoice/$invoiceId/details"); print("👇👇👇 INVOICE API RESPONSE START 👇👇👇"); print(res.data); // <-- THIS IS WHAT YOU NEED print("👆👆👆 INVOICE API RESPONSE END 👆👆👆"); return Map.from(res.data); } catch (e) { print("❌ ERROR (Invoice Details): $e"); return {"success": false, "message": e.toString()}; } } }