With<T> class
Marks a union type to mixin the class type
or stringType
.
In the case below City
will mixin with GeographicArea
.
@freezed
abstract class Example with _$Example {
const factory Example.person(String name, int age) = Person;
@With<AdministrativeArea<House>>()
const factory Example.city(String name, int population) = City;
}
Note: You need to make sure that you comply with the interface requirements by implementing all the abstract members. If the mixin has no members or just fields, you can fulfil the interface contract by adding them in the constructor of the union type. Keep in mind that if the mixin defines a method or a getter, that you implement in the class, you need to use the Custom getters and methods instructions.
Constructors
- With()
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
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