toJson method

Map<String, dynamic> toJson()

Converts this User instance to a JSON object.

Returns a JSON object containing the following keys:

  • "id": The user identifier.
  • "name": The username.
  • "displayName": The display name.

Implementation

Map<String, dynamic> toJson() {
  return {
    'id': id,
    'name': name,
    'displayName': displayName,
  };
}