I have this:
class HonPage extends StatefulWidget {
final Status? status;
HonPage({Key? key, this.status}) : super(key: key);
@override
_HonPageState createState() {
return _HonPageState();
}
}
class _HonPageState extends State<HonPage> {
@override
void initState() {
super.initState();
}
Widget build(BuildContext context) {
return new ListView.builder(
itemCount: 10,
itemBuilder: (context, index) {
return new ListTile(
title: new Text("${widget.status.title ?? ""}"),
);
}
);
}
}
My result:
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
NULL
Whatever I do, I seem not to be able to fetch the items from JSON
.
The JSON and API URL works on all other screens, so that can not be wrong. What am I doing wrong here? It's just that I have created a new tab and want to show the information.
Edit: In Status.dart, I have this:
Status(Map<String, dynamic> json) : super(json) {
status = json["status"];
title = json["title"];
....
}
JSON:
[{"title": "NAME ME", "status": "publish"}]