Skip to content

RPNavigableOrderedTask

The RPNavigableOrderedTask class adds conditional step navigation to the behavior inherited from the RPOrderedTask class. It's able to show different questions based on previous answers by using RPStepNavigationRules. This task allows participant to go back to/looping through previous questions. In that case only the last answer given to the question will be saved.

Inheritance
Annotations

Constructors

RPNavigableOrderedTask.fromJson

RPNavigableOrderedTask.fromJson(
  1. Map<String, dynamic> json
)

RPNavigableOrderedTask

RPNavigableOrderedTask({
  1. required String identifier,
  2. required List<RPStep> steps,
  3. bool closeAfterFinished = true,
})

Properties

fromJsonFunction

Function get fromJsonFunction
override

The function which can convert a JSON string to an object of this type.

stepNavigationRules

Map<String, RPStepNavigationRule> stepNavigationRules
getter/setter pair

A dictionary of step identifier Strings and their corresponding navigation rule(RPStepNavigationRule).

Methods

getStepAfterStep

RPStep? getStepAfterStep(
  1. RPStep? step,
  2. RPTaskResult? result
)
override

Returns the step after a specified step if there's any, taking the RPStepNavigationRules into consideration. If the specified step is null then it returns the first step. Returns null if step was the last one in the sequence.

RPStepNavigationRule navigationRuleForTriggerStepIdentifier(
  1. String triggerStepIdentifier
)

Returns the navigation rule for the given step identifier

removeNavigationRuleForTriggerStepIdentifier

void removeNavigationRuleForTriggerStepIdentifier(
  1. String triggerStepIdentifier
)

Removes the navigation rule from the given step using its identifier

setNavigationRuleForTriggerStepIdentifier

void setNavigationRuleForTriggerStepIdentifier(
  1. RPStepNavigationRule stepNavigationRule,
  2. String triggerStepIdentifier
)

Adds a navigation rule to a step using its identifier.

  RPNavigableOrderedTask navigableSurveyTask = RPNavigableOrderedTask(
    "NavigableTaskID",
    [
      instructionStep,
      questionStep1,
      questionStep2,
    ],
  )
  ..setNavigationRuleForTriggerStepIdentifier(someNavigationRule, questionStep1.identifier);

toJson

Map<String, dynamic> toJson()
override

Return a JSON encoding of this object.