Skip to content

RPStep

The base class for steps which can compose a task.

Each RPStep object represents one logical piece of data entry or activity in a larger task. Whether your app is giving instructions, presenting a form or survey, obtaining consent, or running an active task, everything in the Research Package framework is a collection of steps (RPStep objects), which together form a task (an RPTask object)

Inheritance
Implementers
Annotations

Constructors

RPStep.fromJson

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

RPStep

RPStep({
  1. required String identifier,
  2. required String title,
  3. String? text,
  4. bool optional = false,
  5. String? footnote,
  6. String? nextButtonText,
})

Create a RPStep object with a unique identifier, a title, and a text to be displayed.

Properties

footnote

String? footnote
getter/setter pair

Optional footer text to be displayed below the question. This can be used to provide additional information, such as copyright, or instructions. This text will be displayed in a smaller font size.

fromJsonFunction

Function get fromJsonFunction
override

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

identifier

String identifier
final

A unique identifier of the Step. This identifier connects the step to its result (RPResult) object.

nextButtonText

String? nextButtonText
getter/setter pair

Text for the button that advances past this step.

May be a localization key or a literal — anything the localizations do not recognise is shown as-is.

When null the task-wide RPUITask.nextButtonText is used, which in turn falls back to the localized 'NEXT' key. Set this for steps whose forward action reads better as something specific, e.g. "Start Practicing".

optional

bool optional
getter/setter pair

Can this step be skipped? If so, the result for the step will be null.

stepWidget

Widget? get stepWidget

The widget (UI representation) of the step.

RPQuestionSteps don't have it because their UI representation depends on the Answer Format. Their Answer Format is assessed by RPUIQuestionStep or RPUIFormStep and they return the corresponding UI.

When needed, it should be overridden to fit the different types of Steps.

text

String? text
getter/setter pair

The text of the Step. Different types of Steps are using the text text differently.

For e.g. the text of RPCompletionStep is rendered in the middle of the screen while the RPQuestionStep does not even use it.

timer

  1. @JsonKey(includeFromJson: false, includeToJson: false)
Timer? timer
getter/setter pair

title

String title
getter/setter pair

The title text. Different types of Steps are using the title text differently.

For e.g. the title of RPCompletionStep is rendered in the middle of the screen while the title of an RPQuestionStep is the text of the actual question.

Methods

toJson

Map<String, dynamic> toJson()
override

Return a JSON encoding of this object.