MFieldChar class

MySQL CHAR field type.

Represents a fixed-length character string field in MySQL. Always uses exactly the specified number of characters, padding with spaces if necessary.

Use CHAR for strings that are always the same length (e.g., country codes, status flags).

Inheritance

Constructors

MFieldChar.new({required String name, bool isPrimaryKey = false, bool isAutoIncrement = false, bool isNullable = false, String defaultValue = '', String? comment, List<ValidatorEvent> validators = const [], int length = 255})
Creates a CHAR field.

Properties

comment String?
Optional comment for the field
getter/setter pairinherited
defaultValue String
Default value for the field (empty string means no default)
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
isAutoIncrement bool
Whether this field has auto-increment enabled
getter/setter pairinherited
isNullable bool
Whether this field allows NULL values
getter/setter pairinherited
isPrimaryKey bool
Whether this field is a primary key
getter/setter pairinherited
name String
The name of the field/column
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type FieldTypes
The MySQL data type for this field
getter/setter pairinherited
validators List<ValidatorEvent>
getter/setter pairinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toSQL() String
Generates the SQL field definition for this field.
inherited
toString() String
A string representation of this object.
inherited
validate(dynamic value) Future<List<String>>
Validates the provided value against the field's constraints. Returns a list of validation error messages. @param value is the value to validate @returns a list of validation error messages, empty if valid
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited