User constructor
const
User({
- required String id,
- required String name,
- required String email,
- @Default.new(false) bool emailVerified,
- String? image,
- @Default.new(null) DateTime? createdAt,
- @Default.new(null) DateTime? updatedAt,
- @Default.new(false) bool twoFactorEnabled,
- String? username,
- String? displayUsername,
- @Default.new(false) bool isAnonymous,
- String? phoneNumber,
- @Default.new(false) bool phoneNumberVerified,
- String? role,
- @Default.new(false) bool banned,
- String? banReason,
- DateTime? banExpires,
- @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;