toUnit method

  1. @override
PhysicalQuantities<Length> toUnit(
  1. Length u
)

Implementation

@override
PhysicalQuantities<Length> toUnit(final Length u) {
  return switch (u) {
    Inch() => Inches.from(this),
    Hand() => Hands.from(this),
    Foot() => Feet.from(this),
    Yard() => Yards.from(this),
    Chain() => Chains.from(this),
    Furlong() => Furlongs.from(this),
    Mile() => Miles.from(this),
    League() => Leagues.from(this),
    Metre() => Metres.from(this).scaledTo(u),
    _ => throw UnimplementedError("Unknown ${u.runtimeType}"),
  };
}