DataClass class

Enable and customize data class generation.

Use build.yaml file to set these settings globally

Annotations
  • @Target({TargetKind.classType})

Constructors

DataClass({bool? comparable, bool? stringify, bool? copyable, bool? buildable, bool? changeable, bool? changesVisible, bool? createFieldsClass, bool? fieldsClassVisible, List<Equality> equalities = const []})
Ex. @DataClass() class Product {}
const

Properties

buildable bool?
Create a build class function and *Builder class. Default: false
final
changeable bool?
Adds the change and toChanges method to the class. Default: false
final
changesVisible bool?
Makes public the *Changes classes generated when changeable is enabled. Default: false
final
comparable bool?
Overrides Object.== and Object.hashCode methods. Default: true
final
copyable bool?
Adds the copyWith method to the class. Default: false
final
createFieldsClass bool?
Create a class with all the field names of the class Default: false
final
equalities List<Equality>
This equality is used in the following methods Object.== and Object.hashCode.
final
fieldsClassVisible bool?
Makes public the *Fields classes generated when createFieldsClass is enabled. Default: true
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stringify bool?
Overrides Object.toString method. Default: true Inserting stringify_type: fields in the yaml file, the toString method will use all the fields
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

$equals(Iterable<Object?> self, Iterable<Object?> other) bool
Used by mek_data_class_generator