Weight.fromGrams constructor

Weight.fromGrams(
  1. Rational grams
)

Creates a Weight representing the specified number of grams.

Implementation

factory Weight.fromGrams(Rational grams) =>
    Weight.fromUnits(WeightUnit.gram, grams);