Super constructor

const Super({
  1. bool isAbstract = true,
  2. Type? superType,
  3. Set<Type>? interfaces,
  4. 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.

@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();
}

Implementation

const Super({
  this.isAbstract = true,
  this.superType,
  this.interfaces,
  this.mixins,
});