I used to use RecyclerView in AS but I have recently started learning Flutter.
I've been searching around and I can't seem to find a cohesive document/reference/example to allow an array List to appear in GridView.
List<Test> fbToJson(gdata) {
var tojson = json.decode(gdata).cast<Map<String, dynamic>>();
return tojson.map<Test>((json) => Test.fromJson(json)).toList();
}
class Test {
String imageUrl;
String name;
Test({this.imageUrl,this.name});
factory Test.fromJson(Map<String, dynamic> json) {
return Test(
imageUrl: json['imageUrl'] as String,
name: json['name'] as String
);
}
}
I was already able to pass the above list array to another activity class via Navigator.
My confusion is since this is a list array, I need to iterate through it to show the listed values eg.
for(var i in fbdata){
var myname = i.name;
}
I can't find any doc/resource to help show how to integrate this to a gridview if I wish to show both name and urlimage.
Thanks in advance.