Printing Objects
Except for Null, all classes in Dart derive from Object, which has a toString method. In this case, your object doesn’t tell Dart how to write its internal data when you call toString on it, so Dart gives you this generic, default output instead. But you can override the Object class’s version of toString by writing your implementation of toString and thus customize how your object will print out.
@override
String toString() {
return 'User(id: $id, name: $name)';
}