Information class final
Represents a physical quantity of digital information.
Supports both SI/decimal units (kB, MB, GB, …) and IEC/binary units
(KiB, MiB, GiB, …). The base unit for internal storage is the Bit.
Warning
Precision Limit: quantify uses 64-bit IEEE 754 doubles, which have a maximum
exact integer representation of 2⁵³ (approx. 9.007 × 10¹⁵). Because 1 Pebibyte (PiB)
is exactly 2⁵³ bytes, conversions involving units larger than PiB/PB (such as
Exabytes or Yottabytes) converted down to bits or bytes will experience floating-point
precision loss (rounding errors). For sub-byte precision at Exabyte scales, a
BigInt or arbitrary-precision library is required.
final total = 500.MB + 1.GB; // Information
print(total.inMB); // 1500.0
print(total.inGiB); // ~1.3969838619232178
- Inheritance
-
- Object
- Quantity<
InformationUnit> - LinearQuantity<
InformationUnit, Information> - Information
- Available extensions
- Annotations
-
- @immutable
Constructors
- Information(double _value, InformationUnit _unit)
-
Creates a new Information quantity with the given numerical value and unit.
const
Properties
- asBit → Information
-
Available on Information, provided by the InformationValueGetters extension
Returns an Information representing this quantity in Bits.no setter - asByte → Information
-
Available on Information, provided by the InformationValueGetters extension
Returns an Information representing this quantity in Bytes (B).no setter - asEB → Information
-
Available on Information, provided by the InformationValueGetters extension
Returns an Information representing this quantity in Exabytes (EB).no setter - asEbit → Information
-
Available on Information, provided by the InformationValueGetters extension
Returns an Information representing this quantity in Exabits (Ebit).no setter - asEiB → Information
-
Available on Information, provided by the InformationValueGetters extension
Returns an Information representing this quantity in Exbibytes (EiB).no setter - asGB → Information
-
Available on Information, provided by the InformationValueGetters extension
Returns an Information representing this quantity in Gigabytes (GB).no setter - asGbit → Information
-
Available on Information, provided by the InformationValueGetters extension
Returns an Information representing this quantity in Gigabits (Gbit).no setter - asGiB → Information
-
Available on Information, provided by the InformationValueGetters extension
Returns an Information representing this quantity in Gibibytes (GiB).no setter - asKB → Information
-
Available on Information, provided by the InformationValueGetters extension
Returns an Information representing this quantity in Kilobytes (kB).no setter - asKbit → Information
-
Available on Information, provided by the InformationValueGetters extension
Returns an Information representing this quantity in Kilobits (kbit).no setter - asKiB → Information
-
Available on Information, provided by the InformationValueGetters extension
Returns an Information representing this quantity in Kibibytes (KiB).no setter - asMB → Information
-
Available on Information, provided by the InformationValueGetters extension
Returns an Information representing this quantity in Megabytes (MB).no setter - asMbit → Information
-
Available on Information, provided by the InformationValueGetters extension
Returns an Information representing this quantity in Megabits (Mbit).no setter - asMiB → Information
-
Available on Information, provided by the InformationValueGetters extension
Returns an Information representing this quantity in Mebibytes (MiB).no setter - asPB → Information
-
Available on Information, provided by the InformationValueGetters extension
Returns an Information representing this quantity in Petabytes (PB).no setter - asPbit → Information
-
Available on Information, provided by the InformationValueGetters extension
Returns an Information representing this quantity in Petabits (Pbit).no setter - asPiB → Information
-
Available on Information, provided by the InformationValueGetters extension
Returns an Information representing this quantity in Pebibytes (PiB).no setter - asTB → Information
-
Available on Information, provided by the InformationValueGetters extension
Returns an Information representing this quantity in Terabytes (TB).no setter - asTbit → Information
-
Available on Information, provided by the InformationValueGetters extension
Returns an Information representing this quantity in Terabits (Tbit).no setter - asTiB → Information
-
Available on Information, provided by the InformationValueGetters extension
Returns an Information representing this quantity in Tebibytes (TiB).no setter - asYB → Information
-
Available on Information, provided by the InformationValueGetters extension
Returns an Information representing this quantity in Yottabytes (YB).no setter - asYbit → Information
-
Available on Information, provided by the InformationValueGetters extension
Returns an Information representing this quantity in Yottabits (Ybit).no setter - asYiB → Information
-
Available on Information, provided by the InformationValueGetters extension
Returns an Information representing this quantity in Yobibytes (YiB).no setter - asZB → Information
-
Available on Information, provided by the InformationValueGetters extension
Returns an Information representing this quantity in Zettabytes (ZB).no setter - asZbit → Information
-
Available on Information, provided by the InformationValueGetters extension
Returns an Information representing this quantity in Zettabits (Zbit).no setter - asZiB → Information
-
Available on Information, provided by the InformationValueGetters extension
Returns an Information representing this quantity in Zebibytes (ZiB).no setter - hashCode → int
-
Returns a hash code for this
Quantityinstance.no setterinherited - inBit → double
-
Available on Information, provided by the InformationValueGetters extension
Returns the information value in Bits.no setter - inByte → double
-
Available on Information, provided by the InformationValueGetters extension
Returns the information value in Bytes (B).no setter - inEB → double
-
Available on Information, provided by the InformationValueGetters extension
Returns the information value in Exabytes (EB, SI: 10¹⁸ bytes).no setter - inEbit → double
-
Available on Information, provided by the InformationValueGetters extension
Returns the information value in Exabits (Ebit, SI: 10¹⁸ bits).no setter - inEiB → double
-
Available on Information, provided by the InformationValueGetters extension
Returns the information value in Exbibytes (EiB, IEC: 2⁶⁰ bytes).no setter - inGB → double
-
Available on Information, provided by the InformationValueGetters extension
Returns the information value in Gigabytes (GB, SI: 10⁹ bytes).no setter - inGbit → double
-
Available on Information, provided by the InformationValueGetters extension
Returns the information value in Gigabits (Gbit, SI: 10⁹ bits).no setter - inGiB → double
-
Available on Information, provided by the InformationValueGetters extension
Returns the information value in Gibibytes (GiB, IEC: 2³⁰ bytes).no setter - inKB → double
-
Available on Information, provided by the InformationValueGetters extension
Returns the information value in Kilobytes (kB, SI: 1 000 bytes).no setter - inKbit → double
-
Available on Information, provided by the InformationValueGetters extension
Returns the information value in Kilobits (kbit, SI: 1 000 bits).no setter - inKiB → double
-
Available on Information, provided by the InformationValueGetters extension
Returns the information value in Kibibytes (KiB, IEC: 1 024 bytes).no setter - inMB → double
-
Available on Information, provided by the InformationValueGetters extension
Returns the information value in Megabytes (MB, SI: 10⁶ bytes).no setter - inMbit → double
-
Available on Information, provided by the InformationValueGetters extension
Returns the information value in Megabits (Mbit, SI: 10⁶ bits).no setter - inMiB → double
-
Available on Information, provided by the InformationValueGetters extension
Returns the information value in Mebibytes (MiB, IEC: 2²⁰ bytes).no setter - inPB → double
-
Available on Information, provided by the InformationValueGetters extension
Returns the information value in Petabytes (PB, SI: 10¹⁵ bytes).no setter - inPbit → double
-
Available on Information, provided by the InformationValueGetters extension
Returns the information value in Petabits (Pbit, SI: 10¹⁵ bits).no setter - inPiB → double
-
Available on Information, provided by the InformationValueGetters extension
Returns the information value in Pebibytes (PiB, IEC: 2⁵⁰ bytes).no setter - inTB → double
-
Available on Information, provided by the InformationValueGetters extension
Returns the information value in Terabytes (TB, SI: 10¹² bytes).no setter - inTbit → double
-
Available on Information, provided by the InformationValueGetters extension
Returns the information value in Terabits (Tbit, SI: 10¹² bits).no setter - inTiB → double
-
Available on Information, provided by the InformationValueGetters extension
Returns the information value in Tebibytes (TiB, IEC: 2⁴⁰ bytes).no setter - inYB → double
-
Available on Information, provided by the InformationValueGetters extension
Returns the information value in Yottabytes (YB, SI: 10²⁴ bytes).no setter - inYbit → double
-
Available on Information, provided by the InformationValueGetters extension
Returns the information value in Yottabits (Ybit, SI: 10²⁴ bits).no setter - inYiB → double
-
Available on Information, provided by the InformationValueGetters extension
Returns the information value in Yobibytes (YiB, IEC: 2⁸⁰ bytes).no setter - inZB → double
-
Available on Information, provided by the InformationValueGetters extension
Returns the information value in Zettabytes (ZB, SI: 10²¹ bytes).no setter - inZbit → double
-
Available on Information, provided by the InformationValueGetters extension
Returns the information value in Zettabits (Zbit, SI: 10²¹ bits).no setter - inZiB → double
-
Available on Information, provided by the InformationValueGetters extension
Returns the information value in Zebibytes (ZiB, IEC: 2⁷⁰ bytes).no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- unit → InformationUnit
-
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
-
compareTo(
Quantity< InformationUnit> other) → int -
Compares this quantity to another Quantity of the same type (
T).inherited -
convertTo(
InformationUnit targetUnit) → Information -
Creates a new
Qinstance with the value converted totargetUnit.inherited -
create(
double value, InformationUnit unit) → Information -
Factory that creates a new instance of the concrete subtype
Q.override -
getValue(
InformationUnit targetUnit) → double -
Returns the value of this quantity converted to
targetUnit.inherited -
isEquivalentTo(
Quantity< InformationUnit> 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< InformationUnit> other) → double -
Computes the dimensionless ratio of this quantity to
other.inherited -
toString(
{InformationUnit? targetUnit, QuantityFormat format = QuantityFormat.invariant}) → String -
Returns a string representation of this quantity.
inherited
Operators
-
operator *(
double scalar) → Information -
Multiplies this quantity by a dimensionless
scalar.inherited -
operator +(
Information other) → Information -
Adds
otherto this quantity.inherited -
operator -(
Information other) → Information -
Subtracts
otherfrom this quantity.inherited -
operator /(
double scalar) → Information -
Divides this quantity by a dimensionless
scalar.inherited -
operator <(
Quantity< InformationUnit> other) → bool -
Checks if this quantity's magnitude is less than another's.
inherited
-
operator <=(
Quantity< InformationUnit> 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< InformationUnit> other) → bool -
Checks if this quantity's magnitude is greater than another's.
inherited
-
operator >=(
Quantity< InformationUnit> other) → bool -
Checks if this quantity's magnitude is greater than or equal to another's.
inherited
-
operator unary-(
) → Information -
Negates this quantity.
inherited
Static Properties
-
parser
→ QuantityParser<
InformationUnit, Information> -
The parser instance used to convert strings into Information objects.
final
Static Methods
-
parse(
String input, {List< QuantityFormat> formats = const [QuantityFormat.invariant]}) → Information - Parses a string representation of an information quantity into an Information object.
-
tryParse(
String input, {List< QuantityFormat> formats = const [QuantityFormat.invariant]}) → Information? -
Parses a string representation of an information quantity into an Information object,
returning
nullif the string cannot be parsed.