toJson method

  1. @override
Map<String, dynamic> toJson()
override

Serializes the user into its standard JSON representation.

This form excludes the password field and is appropriate for typical response payloads.

Example:

final json = user.toJson();
print(json['name']);
print(json['email']);

Implementation

@override
Map<String, dynamic> toJson() {
  return {
    "uuid": uuid,
    'name': name,
    'email': email,
    'created_at': createdAt?.toIso8601String(),
    'updated_at': updatedAt?.toIso8601String(),
  };
}