toJson method

Map<String, dynamic> toJson()

Converts this user to a JSON map.

Date-time fields are serialised to ISO 8601 strings via DateTime.toIso8601String, or null when the field is absent. The resulting map mirrors the shape expected by tryFromJson and is suitable for secure storage persistence.

Implementation

Map<String, dynamic> toJson() => <String, dynamic>{
  "id": id,
  "first_name": firstName,
  "last_name": lastName,
  "email": email,
  "notifications_enabled": isNotificationsEnabled,
  "profile_image_url": profileImageUrl,
  "email_verified_at": emailVerifiedAt?.toIso8601String(),
  "created_at": createdAt?.toIso8601String(),
  "updated_at": updatedAt?.toIso8601String(),
};