I created one class as Student.
class Student{
int id;
String name;
Student({this.id,this.name});
}
Now I need to print key – id and name
I created one class as Student.
class Student{
int id;
String name;
Student({this.id,this.name});
}
Now I need to print key – id and name
2
Answers
Create a
toJson
method inside your Student class, and print out your parameters.then,
For a proper way to do that you could check my code below. This is how to override the toString().
Then you could print like this: