Super class
Allows you to create a normal or abstract super class, this class will be named as the annotated one as a normal class it can have a super class, set of mixins, interfaces and even toString, hashCode etc.
@Super()
@Equals()
@HashCode()
@ToString()
@Immutable()
class UserModel extends _UserModel {
UserModel(
String super._firstName,
String super.lastName,
String super.email,
String super.phone,
DateTime super.dateOfBirth,
String super.country,
String super.city,
String super.postalCode,
);
}
// generated code:
// generate class is abstract by default, change [isAbstract].
abstract class _UserModel {
_UserModel(
this._firstName,
this.lastName,
this.email,
this.phone,
this.dateOfBirth,
this.country,
this.city,
this.postalCode,
);
// fields are final if class is annotated with [Immutable] of the meta package.
final String firstName;
final String lastName;
final String email;
final String phone;
final DateTime dateOfBirth;
final String country;
final String city;
final String postalCode;
// following stuff are got only if class is annotated with there annotation.
// for the equality and hashCode they are generated only if the class is immutable.
@override
bool operator ==(Object other) => $equals(other);
@override
int get hashCode => $hashCode();
@override
String toString() => $toString();
}
- Annotations
-
- @Target(<TargetKind>{TargetKind.classType})
Constructors
-
Super.new({bool isAbstract = true, Type? superType, Set<
Type> ? interfaces, Set<Type> ? mixins}) -
Allows you to create a normal or abstract super class,
this class will be named as the annotated one as a normal class
it can have a super class, set of mixins, interfaces
and even toString, hashCode etc.
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
interfaces
→ Set<
Type> ? -
The sets of interfaces which will be implemented by the sub class.
final
- isAbstract → bool
-
Whether this super class is an abstract.
final
-
mixins
→ Set<
Type> ? -
The sets of mixins which will be mixed in this super class.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- superType → Type?
-
Define the super class type that the generated super will be sub off,
in other words this define the super of the super.
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