convertFromTo method

double? convertFromTo(
  1. dynamic from,
  2. dynamic to
)

Implementation

double? convertFromTo(dynamic from, dynamic to) {
  assert(from.runtimeType == to.runtimeType,
      'from and to must be of the same type, e.g. LENGTH');
  Property? property = _propertyCache[from.runtimeType];
  if (property == null) {
    property = getPropertyFromEnum(from);
    if (property == null) {
      return null;
    }
    _propertyCache[from.runtimeType] = property;
  }
  property.convert(from, toDouble());
  return property.getUnit(to).value;
}