Datagen class
Annotation class used to configure code generation options for a Dart data class.
Applying Datagen to a class controls which utility methods and factories
are automatically generated in the companion .datagen.dart file.
Example:
@Datagen(
copyWith: true,
fromJson: true,
toJson: true,
stringify: true,
)
class MyModel { ... }
Constructors
Properties
- copyWith → bool
-
Enables generating a
copyWithmethod for the annotated class.final - equality → bool
-
Enables generating a
hashCodeandoperator ==override.final - fromJson → bool
-
Enables generating a
fromJsonfactory constructor.final - fromJsonList → bool
-
Enables generating a
fromJsonListfactory constructor.final - hashCode → int
-
The hash code for this object.
no setterinherited
- omitFactory → bool
-
Controls whether a
fromJsonfactory is generated in the public class. The factory in the generated.datagen.dartclass is always created.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stringify → bool
-
Enables generating a
toStringoverride method.final - toJson → bool
-
Enables generating a
toJsonmethod.final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited