to method

  1. @override
double to(
  1. Converter<double> other,
  2. double value
)
override

Convertes the given value from this unit to the other unit.

Throws ArgumentError if its not possible to convert between the two units.

Implementation

@override
double to(Converter<double> other, double value) {
  final o = typeCheckConverter<RatioConverter>(other);
  final base = reverse?.call(value) ?? (value * ratio);
  return o.forward?.call(base) ?? (base / o.ratio);
}