۴۰۴ Not Found! قیمت ها به ۴۰۳ برگشت! به مدت محدود!
بزن بریم!باسلام میخواستم دسته بندی برنامه رو به صورت پویا پیاده کنم اما دقیقا الان نمیدونم کجا رو دارم اشتباه میرم کد هام به صورت زیر نوشتم
import 'dart:convert';
import 'package:chasponak/helper/url.dart';
import 'package:http/http.dart' as http;
class Category {
String name ;
int id;
Category({this.name, this.id});
Category.fromJson(Map<String , dynamic> parse){
id = parse['id'];
name = parse['name'];
}
}
sendRequestForGetCategories() async{
var response = await http.get(categories ,headers: {
"Accept" : "application/json"
});
var responseBody = json.decode(response.body)['data'];
List<Category> category = [];
print(responseBody);
responseBody.forEach((item){
print(item);
});
مقدار برگشتی از url هم به صورت زیره
{
"data": [
{
"id": 1,
"name": "املاک",
"parent_id": null,
"created_at": null,
"updated_at": null,
"children": [
{
"id": 11,
"name": "(فروش مسکونی (آپارتمان، خانه، زمین",
"parent_id": 1,
"created_at": null,
"updated_at": null
}
]
},
{
"id": 2,
"name": "وسایل نقلیه",
"parent_id": null,
"created_at": null,
"updated_at": null,
"children": []
},
{
"id": 3,
"name": "لوازم الکترونیکی",
"parent_id": null,
"created_at": null,
"updated_at": null,
"children": []
},
{
"id": 4,
"name": "مربوط به خانه",
"parent_id": null,
"created_at": null,
"updated_at": null,
"children": []
},
{
"id": 5,
"name": "خدمات",
"parent_id": null,
"created_at": null,
"updated_at": null,
"children": []
},
{
"id": 6,
"name": "وسایل شخصی",
"parent_id": null,
"created_at": null,
"updated_at": null,
"children": []
},
{
"id": 7,
"name": "سرگرمی و فراغت",
"parent_id": null,
"created_at": null,
"updated_at": null,
"children": []
},
{
"id": 8,
"name": "اجتماعی",
"parent_id": null,
"created_at": null,
"updated_at": null,
"children": []
},
{
"id": 9,
"name": "برای کسب و کار",
"parent_id": null,
"created_at": null,
"updated_at": null,
"children": []
},
{
"id": 10,
"name": "استخدام و کاریابی",
"parent_id": null,
"created_at": null,
"updated_at": null,
"children": []
}
]
}
ممنونم
آیا مایل به ارسال نوتیفیکیشن و اخبار از طرف راکت هستید ؟