setOptions method

FormStack setOptions(
  1. List<Options> options,
  2. GenericIdentifier identifier, {
  3. String? formName = "default",
})

Add the Result

Implementation

FormStack setOptions(List<Options> options, GenericIdentifier identifier,
    {String? formName = "default"}) {
  FormStackForm? formStack = _forms[formName];
  if (formStack != null) {
    for (var entry in formStack.steps) {
      if (entry is NestedStep) {
        entry.steps?.forEach((element) {
          if (element is NestedStep) {
            element.steps?.forEach((ele) {
              if (ele.id?.id == identifier.id) {
                if (ele is QuestionStep) {
                  ele.options = options;
                }
              }
            });
          } else {
            if (element.id?.id == identifier.id) {
              if (element is QuestionStep) {
                element.options = options;
              }
            }
          }
        });
      } else if (entry.id?.id == identifier.id) {
        if (entry is QuestionStep) {
          entry.options = options;
        }
      }
    }
  }
  return this;
}