updateTreeSingleChoiceDms4<T extends AbsNodeType> function

void updateTreeSingleChoiceDms4<T extends AbsNodeType>(
  1. TreeType<T> tree,
  2. bool chosenValue
)

The tree is single choice, not multiple choice. Viettel DMS.4 customized version: Every node can be chosen, so T.isChosen is never null.

Implementation

void updateTreeSingleChoiceDms4<T extends AbsNodeType>(
    TreeType<T> tree, bool chosenValue) {
  // uncheck all - every node will have isChosen = false
  var root = findRoot(tree);
  uncheckALl(root);

  // update current node value
  tree.data.isChosen = chosenValue;
}