match<T> method
T
match<T>({
- required T streetAddress(
- AddressStreet value
- required T number(
- AddressNumber value
- required T location(
- AddressLocation value
Implementation
T match<T>({
required T Function(AddressStreet value) streetAddress,
required T Function(AddressNumber value) number,
required T Function(AddressLocation value) location,
}) {
return switch (this._index) {
0 => streetAddress(this._value as AddressStreet),
1 => number(this._value as AddressNumber),
2 => location(this._value as AddressLocation),
_ => throw NativeException("Unrecognized case index ${this._index}")
};
}