getParent method

Option? getParent(
  1. Option root
)

Implementation

Option? getParent(Option root) {
  if (root is OptionGroup) {
    for (Option i in root.options) {
      if (i.id == id) {
        return root;
      }

      if (i is OptionGroup) {
        Option? r = getParent(i);

        if (r != null) {
          return i;
        }
      }
    }
  }

  return null;
}