toJson method
Convert the model to a JSON string.
final json = user.toJson();
// '{"id":1,"name":"John","email":"john@test.com"}'
Implementation
String toJson() => jsonEncode(toMap());
Convert the model to a JSON string.
final json = user.toJson();
// '{"id":1,"name":"John","email":"john@test.com"}'
String toJson() => jsonEncode(toMap());