I don't know how to display the values of Topic ID from either the System Topics or Video Requests.
I am getting the source from a http request to this url: https://public.free.beeceptor.com/api
The following is the response.
{
"body": {
"System Topics": [
{
"Topic ID": "2",
"Title": "Tres",
"Description": "Dos"
},
{
"Topic ID": "3",
"Title": "Pls Work",
"Description": "nfewtrwe"
},
{
"Topic ID": "4",
"Title": "Juice",
"Description": "Bar"
}
],
"Video Requests": [
{
"Topic ID": "1",
"From Name": "New User",
"From Email": "[email protected]",
"Title": "What's you first christmas like?",
"Description": "Please tell me about your Christmas?"
},
{
"Topic ID": "4",
"From Name": "New User",
"From Email": "[email protected]",
"Title": "What is your name?",
"Description": ""
},
{
"Topic ID": "5",
"From Name": "New User",
"From Email": "[email protected]",
"Title": "What is your name?",
"Description": ""
},
{
"Topic ID": "6",
"From Name": "New User",
"From Email": "[email protected]",
"Title": "What is your name?",
"Description": ""
},
{
"Topic ID": "7",
"From Name": "New User",
"From Email": "[email protected]",
"Title": "What is your name?",
"Description": ""
},
{
"Topic ID": "8",
"From Name": "New User",
"From Email": "[email protected]",
"Title": "What is your name?",
"Description": ""
},
{
"Topic ID": "9",
"From Name": "New User",
"From Email": "[email protected]",
"Title": "What is your name?",
"Description": "From james"
},
{
"Topic ID": "10",
"From Name": "New User",
"From Email": "[email protected]",
"Title": "What is your name?",
"Description": "From james"
}
]
}
}
I want to display the values into a listview like so but directly from the https stream.
Container(
width: 338,
height: 500.0,
child: ListView.builder(
itemCount: data == null ? 0 : data.length,
itemBuilder: (context, i) {
return Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20.0),
),
height: 74.0,
margin: const EdgeInsets.only(bottom: 10.0),
width: MediaQuery.of(context).size.width,
child: Row(
children: <Widget>[
Container(
child: Text(data[i]["System Topics"]["Topic ID"]),
height: 74.0,
width: 73.0,
decoration: BoxDecoration(
color: Colors.orange,
borderRadius: BorderRadius.only(
topLeft: const Radius.circular(20.0),
bottomLeft: const Radius.circular(20.0)),
),
),
Container(
height: 74.0,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topRight: const Radius.circular(20.0),
bottomRight: const Radius.circular(20.0)),
),
width: 265.0,
child: Center(
child: Text(
data[i],
style:
TextStyle(fontSize: 24.0, color: maincolor),
)),
)
],
),
);
},
),
),
I've already parsed the JSON but when I try using it as an object like this:
Text(questions[i].body.systemTopics.topicid)
It doesn't let me. If I do this however: questions[i].body.systemTopics then it won't throw an error
