toJson method

String toJson()

Convert the model to a JSON string.

final json = user.toJson();
// '{"id":1,"name":"John","email":"john@test.com"}'

Implementation

String toJson() => jsonEncode(toMap());