Implements<T> class Null safety

Marks a union type to implement the interface type or stringType. In the case below City will implement GeographicArea.

@freezed
abstract class Example with _$Example {
  const factory Example.person(String name, int age) = Person;

  @Implements<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 interface 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 interface defines a method or a getter, that you implement in the class, you need to use the Custom getters and methods instructions.

Constructors

Implements()
const

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

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

Operators

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