ConversionNode<T> class

This is the building block of the conversion tree. Thanks to the leafNodes parameter you can set other ConversionNodes that depends on this parent node. Thanks to the coefficientProduct, coefficientSum, conversionType and base parameters you can set the relationship between this node and the parent node.

Constructors

ConversionNode.new({required T name, List<ConversionNode<T>> leafNodes = const [], double coefficientProduct = 1.0, double coefficientSum = 0.0, double? value, String? stringValue, ConversionType conversionType = ConversionType.linearConversion, int? base, bool isConverted = false})

Properties

base int?
This is defined just for numeral system conversion. It defines the base of this number. E.g. 16 for hexadecimal, 10 for decimal, 10 for binary, etc.
getter/setter pair
coefficientProduct double
This is the product coefficient of ConversionType.linearConversion and ConversionType.reciprocalConversion. It is the a coefficient.
getter/setter pair
coefficientSum double
This is the sum coefficient of ConversionType.linearConversion and ConversionType.reciprocalConversion. It is the b coefficient.
getter/setter pair
conversionType ConversionType
This define the conversion type between this node and its parent. The default is ConversionType.linearConversion. This is useless for the root node (because it has no parent node).
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
isConverted bool
If true this node is already converted, false otherwise. The node where the conversion start has isConverted = true.
getter/setter pair
leafNodes List<ConversionNode<T>>
This are the list of the ConversionNodes that depend by this node. These are the children of this parent node.
getter/setter pair
name ↔ T
This is the name of the unit. Can be a String or an enum.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stringValue String?
This the value that has the unit of measurement of this node. This is just for numeral systems conversion. In all the other cases use value.
getter/setter pair
value double?
This the value that has the unit of measurement of this node. This is valid for the most cases. But not for numeral systems conversion.
getter/setter pair

Methods

convert(T name, dynamic value) → void
This method must be used on the root ConversionNode of the conversion. It converts all the ConversionNode of the tree from the ConversionNode which name is equal to name (value is assigned to this ConversionNode) to all the other ConversionNodes of the tree.
getTreeAsList() List<ConversionNode<T>>
Recursive function to get a list of the nodes of the tree
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited