Skip to content

RPTask

The RPTask class defines a task to be carried out by a participant in a research study.

This class is the base class in different types of tasks, like RPOrderedTask and not used as such.

Extend this RPTask class to enable dynamic selection of the steps for a given task. By default, RPOrderedTask extends this class for simple sequential tasks. Each step (RPStep) in a task roughly corresponds to one screen through their stepWidget Widget, and represents the primary unit of work in any task presented by a task view controller.

Inheritance
Implementers
Annotations

Constructors

RPTask.fromJson

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

RPTask

RPTask({
  1. required String identifier,
  2. bool closeAfterFinished = false,
})

Properties

closeAfterFinished

bool closeAfterFinished
getter/setter pair

If set to true the Task will close after the participant has finished the task. If it's set to false no navigation function is called.

Navigation or closing is still possible for example in the onSubmit function of RPUIOrderedTask.

fromJsonFunction

Function get fromJsonFunction
override

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

identifier

String identifier
getter/setter pair

A unique identifier of the Task. This identifier connects the Task to its result (RPTaskResult) object.

Methods

getStepAfterStep

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

Returns the step after a specified step if there's any.

getStepBeforeStep

RPStep? getStepBeforeStep(
  1. RPStep step,
  2. RPTaskResult result
)

Returns the step that precedes the specified step, if there is one.

getStepWithIdentifier

RPStep? getStepWithIdentifier(
  1. String identifier
)

Returns the step that matches the specified identifier.

getTitleForStep

String getTitleForStep(
  1. RPStep step
)

Returns the title of a given step

toJson

Map<String, dynamic> toJson()
override

Return a JSON encoding of this object.