Voltage class final

Represents a quantity of electric potential (voltage).

Electric potential, commonly called voltage, is the difference in electric potential energy per unit of electric charge between two points. The SI derived unit for voltage is the Volt (V), defined as one watt per ampere (W/A) or one joule per coulomb (J/C).

This class provides a type-safe way to handle voltage values and conversions between different units (e.g., volts, millivolts, kilovolts).

Inheritance
Available extensions
Annotations
  • @immutable

Constructors

Voltage(double _value, VoltageUnit _unit)
Creates a new Voltage quantity with the given numerical value and unit.
const
Voltage.from(Current current, Resistance resistance)
Creates a Voltage from Current and Resistance using Ohm's law (V = I × R).
factory
Voltage.fromEnergyAndCharge(Energy energy, ElectricCharge charge)
Creates a Voltage from Energy and ElectricCharge (V = E / Q).
factory
Voltage.fromPowerAndCurrent(Power power, Current current)
Creates a Voltage from Power and Current (V = P / I).
factory

Properties

asAbvolts Voltage

Available on Voltage, provided by the VoltageValueGetters extension

Returns a new Voltage object representing this voltage in Abvolts (abV).
no setter
asGigavolts Voltage

Available on Voltage, provided by the VoltageValueGetters extension

Returns a new Voltage object representing this voltage in Gigavolts (GV).
no setter
asKilovolts Voltage

Available on Voltage, provided by the VoltageValueGetters extension

Returns a new Voltage object representing this voltage in Kilovolts (kV).
no setter
asMegavolts Voltage

Available on Voltage, provided by the VoltageValueGetters extension

Returns a new Voltage object representing this voltage in Megavolts (MV).
no setter
asMicrovolts Voltage

Available on Voltage, provided by the VoltageValueGetters extension

Returns a new Voltage object representing this voltage in Microvolts (µV).
no setter
asMillivolts Voltage

Available on Voltage, provided by the VoltageValueGetters extension

Returns a new Voltage object representing this voltage in Millivolts (mV).
no setter
asNanovolts Voltage

Available on Voltage, provided by the VoltageValueGetters extension

Returns a new Voltage object representing this voltage in Nanovolts (nV).
no setter
asStatvolts Voltage

Available on Voltage, provided by the VoltageValueGetters extension

Returns a new Voltage object representing this voltage in Statvolts (statV).
no setter
asVolts Voltage

Available on Voltage, provided by the VoltageValueGetters extension

Returns a new Voltage object representing this voltage in Volts (V).
no setter
hashCode int
Returns a hash code for this Quantity instance.
no setterinherited
inAbvolts double

Available on Voltage, provided by the VoltageValueGetters extension

Returns the voltage value in Abvolts (abV).
no setter
inGigavolts double

Available on Voltage, provided by the VoltageValueGetters extension

Returns the voltage value in Gigavolts (GV).
no setter
inKilovolts double

Available on Voltage, provided by the VoltageValueGetters extension

Returns the voltage value in Kilovolts (kV).
no setter
inMegavolts double

Available on Voltage, provided by the VoltageValueGetters extension

Returns the voltage value in Megavolts (MV).
no setter
inMicrovolts double

Available on Voltage, provided by the VoltageValueGetters extension

Returns the voltage value in Microvolts (µV).
no setter
inMillivolts double

Available on Voltage, provided by the VoltageValueGetters extension

Returns the voltage value in Millivolts (mV).
no setter
inNanovolts double

Available on Voltage, provided by the VoltageValueGetters extension

Returns the voltage value in Nanovolts (nV).
no setter
inStatvolts double

Available on Voltage, provided by the VoltageValueGetters extension

Returns the voltage value in Statvolts (statV).
no setter
inVolts double

Available on Voltage, provided by the VoltageValueGetters extension

Returns the voltage value in Volts (V).
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
unit VoltageUnit
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

asVoltageLevel(VoltageLevelUnit targetUnit) VoltageLevel

Available on Voltage, provided by the VoltageVoltageLevelBridge extension

Alias for toVoltageLevel.
compareTo(Quantity<VoltageUnit> other) int
Compares this quantity to another Quantity of the same type (T).
inherited
convertTo(VoltageUnit targetUnit) Voltage
Creates a new Q instance with the value converted to targetUnit.
inherited
create(double value, VoltageUnit unit) Voltage
Factory that creates a new instance of the concrete subtype Q.
override
currentThrough(Resistance resistance) Current
Calculates the Current through a given Resistance using Ohm's law (I = V / R).
getValue(VoltageUnit targetUnit) double
Returns the value of this quantity converted to targetUnit.
inherited
isEquivalentTo(Quantity<VoltageUnit> 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<VoltageUnit> other) double
Computes the dimensionless ratio of this quantity to other.
inherited
toString({VoltageUnit? targetUnit, QuantityFormat format = QuantityFormat.invariant}) String
Returns a string representation of this quantity.
inherited
toVoltageLevel(VoltageLevelUnit targetUnit) VoltageLevel

Available on Voltage, provided by the VoltageVoltageLevelBridge extension

Converts this voltage to a logarithmic VoltageLevel using targetUnit's reference.

Operators

operator *(double scalar) Voltage
Multiplies this quantity by a dimensionless scalar.
inherited
operator +(Voltage other) Voltage
Adds other to this quantity.
inherited
operator -(Voltage other) Voltage
Subtracts other from this quantity.
inherited
operator /(double scalar) Voltage
Divides this quantity by a dimensionless scalar.
inherited
operator <(Quantity<VoltageUnit> other) bool
Checks if this quantity's magnitude is less than another's.
inherited
operator <=(Quantity<VoltageUnit> 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<VoltageUnit> other) bool
Checks if this quantity's magnitude is greater than another's.
inherited
operator >=(Quantity<VoltageUnit> other) bool
Checks if this quantity's magnitude is greater than or equal to another's.
inherited
operator unary-() Voltage
Negates this quantity.
inherited

Static Properties

parser QuantityParser<VoltageUnit, Voltage>
The parser instance used to convert strings into Voltage objects.
final

Static Methods

parse(String input, {List<QuantityFormat> formats = const [QuantityFormat.invariant]}) Voltage
Parses a string representation of voltage into a Voltage object.
tryParse(String input, {List<QuantityFormat> formats = const [QuantityFormat.invariant]}) Voltage?
Attempts to parse a string representation of voltage. Returns null if parsing fails.