User constructor

const User({
  1. required String id,
  2. required String name,
  3. required String email,
  4. @Default.new(false) bool emailVerified,
  5. String? image,
  6. @Default.new(null) DateTime? createdAt,
  7. @Default.new(null) DateTime? updatedAt,
  8. @Default.new(false) bool twoFactorEnabled,
  9. String? username,
  10. String? displayUsername,
  11. @Default.new(false) bool isAnonymous,
  12. String? phoneNumber,
  13. @Default.new(false) bool phoneNumberVerified,
  14. String? role,
  15. @Default.new(false) bool banned,
  16. String? banReason,
  17. DateTime? banExpires,
  18. @JsonKey.new(readValue: _readUserAdditionalFields, includeToJson: false) @Default.new(<String, dynamic>{}) Map<String, dynamic> additionalFields,
})

Implementation

const factory User({
  required String id,
  required String name,
  required String email,
  @Default(false) bool emailVerified,
  String? image,
  @Default(null) DateTime? createdAt,
  @Default(null) DateTime? updatedAt,
  @Default(false) bool twoFactorEnabled,
  String? username,
  String? displayUsername,
  @Default(false) bool isAnonymous,
  String? phoneNumber,
  @Default(false) bool phoneNumberVerified,
  String? role,
  @Default(false) bool banned,
  String? banReason,
  DateTime? banExpires,

  /// Server-defined custom fields ([`additionalFields`](https://www.better-auth.com/docs/concepts/database#extending-core-schema))
  /// that aren't part of the static [User] shape. Populated from unmapped JSON
  /// keys by [User.fromJson]; never serialized back out. Read via the `field`
  /// extension, e.g. `user.field<String>('firstName')`.
  @JsonKey(readValue: _readUserAdditionalFields, includeToJson: false)
  @Default(<String, dynamic>{})
  Map<String, dynamic> additionalFields,
}) = _User;