Power class final
Represents a quantity of power.
Power is the rate at which energy is transferred or work is done. The SI derived unit for power is the Watt (W), defined as one Joule per second. This class provides a type-safe way to handle power values and conversions between different units (e.g., watts, horsepower, Btu/h).
- Inheritance
- Available extensions
- Annotations
-
- @immutable
Constructors
- Power(double _value, PowerUnit _unit)
-
Creates a new
Powerquantity with the given numerical value and unit.const - Power.from(Energy energy, Time duration)
-
Creates a Power from
energyandduration(P = E / t).factory - Power.fromCurrentAndResistance(Current current, Resistance resistance)
-
Creates a Power from Current and Resistance using Joule's law (P = I² × R).
factory
- Power.fromTorqueAndAngularVelocity(Torque torque, AngularVelocity velocity)
-
Creates a Power from Torque and AngularVelocity (P = τ × ω).
factory
- Power.fromVoltageAndCurrent(Voltage voltage, Current current)
-
Creates a Power from Voltage and Current (P = V × I).
factory
- Power.fromVoltageAndResistance(Voltage voltage, Resistance resistance)
-
Creates a Power from Voltage and Resistance (P = V² / R).
factory
Properties
- asBtuPerHour → Power
-
Available on Power, provided by the PowerValueGetters extension
Returns a new Power object representing this power in British Thermal Units per hour (Btu/h).no setter - asErgPerSecond → Power
-
Available on Power, provided by the PowerValueGetters extension
Returns a new Power object representing this power in Ergs per second (erg/s).no setter - asGigawatts → Power
-
Available on Power, provided by the PowerValueGetters extension
Returns a new Power object representing this power in Gigawatts (GW).no setter - asHorsepower → Power
-
Available on Power, provided by the PowerValueGetters extension
Returns a new Power object representing this power in mechanical Horsepower (hp).no setter - asKilowatts → Power
-
Available on Power, provided by the PowerValueGetters extension
Returns a new Power object representing this power in Kilowatts (kW).no setter - asMegawatts → Power
-
Available on Power, provided by the PowerValueGetters extension
Returns a new Power object representing this power in Megawatts (MW).no setter - asMetricHorsepower → Power
-
Available on Power, provided by the PowerValueGetters extension
Returns a new Power object representing this power in metric Horsepower (PS).no setter - asMicrowatts → Power
-
Available on Power, provided by the PowerValueGetters extension
Returns a new Power object representing this power in Microwatts (µW).no setter - asMilliwatts → Power
-
Available on Power, provided by the PowerValueGetters extension
Returns a new Power object representing this power in Milliwatts (mW).no setter - asNanowatts → Power
-
Available on Power, provided by the PowerValueGetters extension
Returns a new Power object representing this power in Nanowatts (nW).no setter - asTerawatts → Power
-
Available on Power, provided by the PowerValueGetters extension
Returns a new Power object representing this power in Terawatts (TW).no setter - asWatts → Power
-
Available on Power, provided by the PowerValueGetters extension
Returns a new Power object representing this power in Watts (W).no setter - hashCode → int
-
Returns a hash code for this
Quantityinstance.no setterinherited - inBtuPerHour → double
-
Available on Power, provided by the PowerValueGetters extension
Returns the power value in British Thermal Units per hour (Btu/h).no setter - inErgPerSecond → double
-
Available on Power, provided by the PowerValueGetters extension
Returns the power value in Ergs per second (erg/s).no setter - inGigawatts → double
-
Available on Power, provided by the PowerValueGetters extension
Returns the power value in Gigawatts (GW).no setter - inHorsepower → double
-
Available on Power, provided by the PowerValueGetters extension
Returns the power value in mechanical Horsepower (hp).no setter - inKilowatts → double
-
Available on Power, provided by the PowerValueGetters extension
Returns the power value in Kilowatts (kW).no setter - inMegawatts → double
-
Available on Power, provided by the PowerValueGetters extension
Returns the power value in Megawatts (MW).no setter - inMetricHorsepower → double
-
Available on Power, provided by the PowerValueGetters extension
Returns the power value in metric Horsepower (PS).no setter - inMicrowatts → double
-
Available on Power, provided by the PowerValueGetters extension
Returns the power value in Microwatts (µW).no setter - inMilliwatts → double
-
Available on Power, provided by the PowerValueGetters extension
Returns the power value in Milliwatts (mW).no setter - inNanowatts → double
-
Available on Power, provided by the PowerValueGetters extension
Returns the power value in Nanowatts (nW).no setter - inTerawatts → double
-
Available on Power, provided by the PowerValueGetters extension
Returns the power value in Terawatts (TW).no setter - inWatts → double
-
Available on Power, provided by the PowerValueGetters extension
Returns the power value in Watts (W).no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- unit → PowerUnit
-
Returns the unit of measurement associated with this quantity's original value.
no setterinherited
- value → double
-
Returns the numerical value of this quantity in its original unit.
no setterinherited
Methods
-
asPowerLevel(
PowerLevelUnit targetUnit) → PowerLevel -
Available on Power, provided by the PowerPowerLevelBridge extension
Alias for toPowerLevel. -
compareTo(
Quantity< PowerUnit> other) → int -
Compares this quantity to another Quantity of the same type (
T).inherited -
convertTo(
PowerUnit targetUnit) → Power -
Creates a new
Qinstance with the value converted totargetUnit.inherited -
create(
double value, PowerUnit unit) → Power -
Factory that creates a new instance of the concrete subtype
Q.override -
getValue(
PowerUnit targetUnit) → double -
Returns the value of this quantity converted to
targetUnit.inherited -
isEquivalentTo(
Quantity< PowerUnit> other, {double tolerance = 1e-9, double absoluteTolerance = 0.0}) → bool -
Checks if this quantity has the same physical magnitude as another,
accounting for IEEE 754 floating-point rounding inaccuracies.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
ratioTo(
Quantity< PowerUnit> other) → double -
Computes the dimensionless ratio of this quantity to
other.inherited -
timeFor(
Energy energy) → Time - Calculates the Time required to transfer or work a given Energy.
-
toPowerLevel(
PowerLevelUnit targetUnit) → PowerLevel -
Available on Power, provided by the PowerPowerLevelBridge extension
Converts this power to a logarithmic PowerLevel usingtargetUnit's reference. -
toString(
{PowerUnit? targetUnit, QuantityFormat format = QuantityFormat.invariant}) → String -
Returns a string representation of this quantity.
inherited
Operators
-
operator *(
double scalar) → Power -
Multiplies this quantity by a dimensionless
scalar.inherited -
operator +(
Power other) → Power -
Adds
otherto this quantity.inherited -
operator -(
Power other) → Power -
Subtracts
otherfrom this quantity.inherited -
operator /(
double scalar) → Power -
Divides this quantity by a dimensionless
scalar.inherited -
operator <(
Quantity< PowerUnit> other) → bool -
Checks if this quantity's magnitude is less than another's.
inherited
-
operator <=(
Quantity< PowerUnit> other) → bool -
Checks if this quantity's magnitude is less than or equal to another's.
inherited
-
operator ==(
Object other) → bool -
Determines whether this Quantity is equal to another Object.
inherited
-
operator >(
Quantity< PowerUnit> other) → bool -
Checks if this quantity's magnitude is greater than another's.
inherited
-
operator >=(
Quantity< PowerUnit> other) → bool -
Checks if this quantity's magnitude is greater than or equal to another's.
inherited
-
operator unary-(
) → Power -
Negates this quantity.
inherited
Static Properties
-
parser
→ QuantityParser<
PowerUnit, Power> -
The parser instance used to convert strings into Power objects.
final
Static Methods
-
parse(
String input, {List< QuantityFormat> formats = const [QuantityFormat.invariant]}) → Power - Parses a string representation of power into a Power object.
-
tryParse(
String input, {List< QuantityFormat> formats = const [QuantityFormat.invariant]}) → Power? -
Attempts to parse a string representation of power. Returns
nullif parsing fails.