convert method

void convert(
  1. double value
)

Convert this ConversionNode to all the other units

Implementation

void convert(double value) {
  this.value = value;

  Queue<ConversionNode> queue = Queue.from([this]);
  while (queue.isNotEmpty) {
    ConversionNode node = queue.removeFirst();

    final parent = node.parent;
    if (parent != null && parent.value == null) {
      _convertParentFromChild(node.parent!, node);
      queue.addLast(parent);
    }

    final children = node.children;
    if (children.isNotEmpty) {
      for (ConversionNode child in children) {
        if (child.value == null) {
          _convertParentToChild(node, child);
        }
        queue.addLast(child);
      }
    }
  }
}