Search code examples
flutterflutter-dependenciesdio

given json response how to binding in list flutter using dio?


{ "success": true, "data": [ { "id": 11, "order_ref_no": "OA-1624432086", "customer_id": 1, "customer_address_id": 1, "order_date": "2021-06-23", "delivery_date": "2021-06-27", "delivery_time_from": "12:00:00", "delivery_time_to": "14:00:00", "sub_total": 679, "delivery_charges": 22, "order_total": 701, "order_status": "completed", "customer": { "id": 1, "photo": "https://drive.google.com/uc?id=17nPK4ChZG1Pv7hkYI0MN2ZYsjj646yI7&export=media", "first_name": "vishal", "last_name": "sharma", "email": "vishal@gmail.com", "mobile": "+91 1111111111", "dob": "2021-06-17", "mobile_verified": "true", "fcm_token": null, "latitude": null, "longitude": null, "status": "active", "created_at": "2021-06-17 05:35:51", "updated_at": "2021-06-23 10:28:00" }, "customer_address": { "id": 1, "customer_id": 1, "address_type": "office", "receiver_name": "megha", "receiver_contact_number": "9632589632", "state_id": 1, "area": "nikol", "pincode": 382350, "house_no": "c-122", "city_id": 2, "address_1": "bhakti circle", "address_2": "Ahmedabad,gujarat,india", "latitude": "23.1218578", "longitude": "72.545334", "created_at": "2021-06-17 10:07:36", "updated_at": "2021-06-23 07:06:04", "deleted_at": null }, "order_invoice": [ { "id": 10, "order_id": 11, "vendor_id": 8, "delivery_boy_id": 1, "invoice_ref_no": "INV-16244320863", "total": 199, "admin_commission": 0, "invoice_total": 199, "status": "delivered", "created_at": "2021-06-23 07:08:06", "updated_at": "2021-06-23 13:17:42", "vendor_data": { "id": 8, "vendor_image": "https://drive.google.com/uc?id=1sLdbAUjb9TbVUX6yxdZ6qbMi9EDUbjkf&export=media", "vendor_name": "Veggy Shop", "employee_name": "Srikant", "dob": "1980-06-17", "admin_share": "2", "mobile": "+91 9292929292", "email": "sri@gmail.com", "city_id": 1, "delivery_range": "2", "is_best_seller": 1, "is_trending": 1, "latitude": "19.6641°", "longitude": "78.5320°", "fcm_token": null, "vendor_address": "Near Head Street", "start_time": null, "end_time": null, "time_interval": null, "created_at": "2021-06-17 12:29:48", "updated_at": "2021-06-17 12:29:48", "vendor_status": "online", "status": "active", "mobile_verified": "false" }, "order_invoice_items": [ { "id": 25, "invoice_id": 10, "vendor_id": 8, "product_id": 6, "product_name": "Fresh Orange", "product_image": "https://drive.google.com/uc?id=1qgYHU1Bdqt4o8KZsY4lhyJl5Wsn_Bcxp&export=media", "unit": "Kg", "weight": "1", "qty": 1, "mrp": 299, "price": 199, "total_price": 199, "vendor_admin_commission": 0, "item_status": "pending", "created_at": "2021-06-23 07:08:06", "updated_at": "2021-06-23 07:08:06" } ] }, { "id": 11, "order_id": 11, "vendor_id": 1, "delivery_boy_id": 1, "invoice_ref_no": "INV-16244320866", "total": 360, "admin_commission": 0, "invoice_total": 360, "status": "delivered", "created_at": "2021-06-23 07:08:06", "updated_at": "2021-06-23 13:17:42", "vendor_data": { "id": 1, "vendor_image": "https://drive.google.com/uc?id=1Zwskric14eE6vfDVINALWEiczP7Y0SNo&export=media", "vendor_name": "Shiv Shakti Dairy", "employee_name": "Shashikant Gupta", "dob": "1999-06-01", "admin_share": "5", "mobile": "+91 1234567890", "email": "shiv@yahoo.com", "city_id": 5, "delivery_range": "5", "is_best_seller": 1, "is_trending": 1, "latitude": "23.0550°", "longitude": "72.5493°", "fcm_token": null, "vendor_address": "Near Dream lack", "start_time": null, "end_time": null, "time_interval": null, "created_at": "2021-06-17 06:58:37", "updated_at": "2021-06-23 10:31:47", "vendor_status": "online", "status": "active", "mobile_verified": "false" }, "order_invoice_items": [ { "id": 26, "invoice_id": 11, "vendor_id": 1, "product_id": 1, "product_name": "Amul Milk", "product_image": "https://drive.google.com/uc?id=1O61-FmFD0pgqSKpgjRdi4X6wEMtaQF7l&export=media", "unit": "Kg", "weight": "1", "qty": 2, "mrp": 200, "price": 180, "total_price": 360, "vendor_admin_commission": 0, "item_status": "pending", "created_at": "2021-06-23 07:08:06", "updated_at": "2021-06-23 07:08:06" } ] }, { "id": 12, "order_id": 11, "vendor_id": 7, "delivery_boy_id": 1, "invoice_ref_no": "INV-16244320869", "total": 480, "admin_commission": 0, "invoice_total": 480, "status": "delivered", "created_at": "2021-06-23 07:08:06", "updated_at": "2021-06-23 13:17:42", "vendor_data": { "id": 7, "vendor_image": null, "vendor_name": "vikas sharma", "employee_name": "vikas", "dob": "1996-08-20", "admin_share": "2", "mobile": "+91 9772718131", "email": "vks7860@gmail.com", "city_id": 9, "delivery_range": "50", "is_best_seller": 0, "is_trending": 0, "latitude": "27.903875000000003", "longitude": "74.925035", "fcm_token": null, "vendor_address": "sikar", "start_time": null, "end_time": null, "time_interval": null, "created_at": "2021-06-17 10:26:56", "updated_at": "2021-06-24 12:56:23", "vendor_status": "online", "status": "active", "mobile_verified": "true" }, "order_invoice_items": [ { "id": 27, "invoice_id": 12, "vendor_id": 1, "product_id": 1, "product_name": "Amul Milk", "product_image": "https://drive.google.com/uc?id=1O61-FmFD0pgqSKpgjRdi4X6wEMtaQF7l&export=media", "unit": "Kg", "weight": "1", "qty": 2, "mrp": 200, "price": 180, "total_price": 360, "vendor_admin_commission": 0, "item_status": "pending", "created_at": "2021-06-23 07:08:06", "updated_at": "2021-06-23 07:08:06" }, { "id": 28, "invoice_id": 12, "vendor_id": 7, "product_id": 9, "product_name": "Chocolate Cack", "product_image": "https://drive.google.com/uc?id=1yeuAQaiRH9656oUzsaR7-Bu8147RK3Q3&export=media", "unit": "Litres", "weight": "1.25", "qty": 2, "mrp": 75, "price": 60, "total_price": 120, "vendor_admin_commission": 0, "item_status": "pending", "created_at": "2021-06-23 07:08:06", "updated_at": "2021-06-23 07:08:06" } ] } ], "order_payment": { "id": 25, "order_id": 11, "payment_mode": "Cash on delivery", "transaction_id": "paisa lai lidha che", "comment": "vshs", "amount": 701, "document": null, "created_at": "2021-06-23 11:21:59", "updated_at": "2021-06-23 11:21:59" }, "status": "delivered" } ], "message": "Order detail found successfully!!" }


Solution

  • Welcome Parth, Your question is not clear but As I understand you are trying to get "data" field into list. Only call following ;

    List armut = yourjsonname["data"];
    

    Please when you attempt to ask question, give information about it next time.