[
{
"name": "School1",
"image": "url1",
"place": "place1",
"class": [
{
"class": "first",
"strength": "25",
"students": [
{
"id": "student1",
"dob": "mdd:mm:yyyy",
"age": 6,
"fees": 0
},
{
"id": "student2",
"dob": "mdd:mm:yyyy",
"age": 6,
"fees": 1
}
]
},
{
"class": "second",
"strength": 30,
"students": [
{
"id": "student1",
"dob": "mdd:mm:yyyy",
"age": 6,
"fees": 0
},
{
"id": "student2",
"dob": "mdd:mm:yyyy",
"age": 6,
"fees": 1
}
]
}
]
},
{
"name": "School2",
"image": "url2",
"place": "place2",
"class": [
{
"class": "first",
"strength": "25",
"students": [
{
"id": "student1",
"dob": "mdd:mm:yyyy",
"age": 6,
"fees": 0
},
{
"id": "student2",
"dob": "mdd:mm:yyyy",
"age": 6,
"fees": 1
}
]
},
{
"class": "second",
"strength": 30,
"students": [
{
"id": "student1",
"dob": "mdd:mm:yyyy",
"age": 6,
"fees": 0
},
{
"id": "student2",
"dob": "mdd:mm:yyyy",
"age": 6,
"fees": 1
}
]
}
]
}
]
Refer above Json data
How to create add data after satisfy specific conditions in FLUTTER/DART. Here I need some helps in single code file. Please help me.
- Save the entire data to a list.
- Show students by id with dob and age from specific school to a listview.
- On click on the student position, show the details like School name, class, strength of class, age, dob in another screen.
- Create another two listviews which showing student name with school name based on fees paid or unpaid conditions (fees paid=1, unpaid=0 in the data).
Your question needs an answer quite long...
I'll try to give you a few hint. First of all, create the corresponding dart classes from your json data.
I suggest you to give a look at : https://app.quicktype.io/ it is an "instantly parse json in any language", you can put your json code and parse into dart.
Hereafter what I have generated from your json example:
Ok, now you have the model classes. This should answer to your point 1., you can save your Welcome List to a json and viceversa.
For the point 2., you should use a ListView.build() , for example using a list of Students ( List items = .... ; ) :
This is your build method used to show a list of Cards, that show a simple title of your Students objects.
Use the onTap() {...} method to show the Student detail.