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 = getPropertyFromEnum(from);
  if (property == null) {
    return null;
  } else {
    property.convert(from, toDouble());
    return property.getUnit(to).value;
  }
}