MField class abstract

Abstract base class for all MySQL field types.

This class provides the common structure and behavior for all database field types, including properties for constraints, defaults, and comments.

All concrete field implementations should extend this class and provide their specific field type through the FieldTypes enum.

Implemented types

Constructors

MField.new({required String name, required FieldTypes type, bool isPrimaryKey = false, bool isAutoIncrement = false, bool isNullable = false, String defaultValue = '', String? comment, List<ValidatorEvent> validators = const []})
Creates a new MySQL field definition.

Properties

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

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.
override
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

Operators

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