toKilogramPerMeter method

num toKilogramPerMeter(
  1. MassPerLengthUnit unit
)

convert num from unit to kilograms per meters

Implementation

num toKilogramPerMeter(MassPerLengthUnit unit) {
  switch (unit) {
    case MassPerLengthUnit.gramPerMeter:
      return toGram;
    case MassPerLengthUnit.gramPerMile:
      return toGram.toMeter(LengthUnit.mile);
    case MassPerLengthUnit.gramPerKilometer:
      return toGram.toMeter(LengthUnit.kilometer);
    case MassPerLengthUnit.kilogramPerKilometer:
      return toKilometer;
    default:
      return this;
  }
}