operator ^ method
Raises this unit to the power of exponent, creating a new DerivedUnit.
If the exponent is 1, the unit is returned unchanged.
Unit exponentiation (as occurs when a physical quantity is raised to a power)
is accomplished by raising its dimensions and scale to the power of exponent.
See also Dimensions.operator^.
Implementation
Unit operator ^(num exponent) {
if (exponent == 1) return this;
return DerivedUnit(
dimensions: dimensions ^ exponent,
scale: pow(scale, exponent),
symbol: '$safeSymbol${numToSuperscript(exponent.toString())}',
singular: '$safeSingular${numToSuperscript(exponent.toString())}',
plural: '$safePlural${numToSuperscript(exponent.toString())}',
);
}