Research Package
Surveys, informed consent and structured results for Flutter research apps, modeled on Apple's ResearchKit.
research_package shows surveys and informed consent flows in a Flutter app and returns the participant's answers as structured results. It is a Flutter implementation of Apple's ResearchKit. You define a task as a list of steps, and the package shows one screen per step on Android and iOS.
The package is part of CARP and works in any Flutter app. In a CARP Mobile Sensing (CAMS) study, carp_survey_package turns these tasks into app tasks and stores their results as measurements. See Survey Sampling Package.
Version 3.2.0 in CAMS apps
These pages document research_package 4.0.0, while apps that also use carp_survey_package or cognition_package get 3.2.0, because both packages require version 3. Tasks, steps, answer formats and results have the same API in both versions, but the permission API differs. For the differences, see Migrate to 4.0.
Features
Surveys
Build surveys from instruction, question, form, timer and completion steps, with seven answer formats.
Informed consent
Explain the study section by section, ask for permissions in context and collect a signature.
Branching
Skip questions, or keep only the steps that earlier answers select, with navigation rules.
Localization
The package's own texts come in seven languages, and every text in a task can be a translation key.
Results
Each run returns one RPTaskResult with the answers and their timestamps, which serializes to JSON.
Activity steps
Run interactive tests that log timings and gestures, such as the cognitive tests in cognition_package.
Requirements
| Component | Requirement |
|---|---|
| Dart SDK | 3.12 or later |
| Flutter | 3.44 or later |
| Android | API level 24 (Android 7.0) or later |
| iOS | 15.0 or later |
The Android and iOS minimums come from the video_player plugin, which plays videos in instruction steps. To ask for permissions in a consent flow, your app adds a plugin such as permission_handler, which brings its own requirements. See Permissions.
How it works
flowchart LR
Task["<b>Task</b><br/>an RPOrderedTask<br/>with its steps"] --> UI["<b>RPUITask</b><br/>one screen per step"]
UI -->|onSubmit| App["<b>Your app</b><br/>receives one<br/>RPTaskResult"]
The flow has three stages:
- Your app builds a task: an
RPOrderedTaskwith a list of steps, in which each question step has an answer format. RPUITaskshows the steps one screen at a time and records a result for each step that collects an answer.- After the last step,
RPUITaskcallsonSubmitwith oneRPTaskResultand closes its route.
A task with one slider question, shown on a new route:
Next steps
Installation
Add the package, its localization delegates and its translation files.
Quickstart
Build a short survey and print the answers as JSON.
Tasks and steps
Task classes and every step type, with their parameters.
Informed consent
Build a consent flow with sections, permissions and a signature.