Skip to content

RPConsentSection

A content section in a RPConsentDocument.

It represents one section in a RPConsentDocument.

Inheritance
Annotations

Constructors

RPConsentSection.fromJson

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

RPConsentSection

RPConsentSection({
  1. required RPConsentSectionType type,
  2. String? title,
  3. required String summary,
  4. String? content,
  5. List<RPDataTypeSection>? dataTypes,
  6. List<RPPermissionType>? permissions,
  7. List<HealthDataType>? healthDataTypes,
  8. Widget? customIllustration,
})

Create a new RPConsentSection of a given type.

It is enough to provide the type and summary of the section. If a title is not provided, a default title is used, unless the type is RPConsentSectionType.Custom. In that case, the title must be provided.

Properties

content

String? content
getter/setter pair

A longer content text of the section.

It's presented during RPVisualConsentStep when tapping on the "Learn more" button and during RPConsentReviewStep where each section's content is shown to the user.

customIllustration

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

A custom illustration (an Image or Icon to show for Custom RPConsentSectionType

dataTypes

List<RPDataTypeSection>? dataTypes
getter/setter pair

The data type sections that will be displayed if the consent section is of type UserDataCollection or PassiveDataCollection.

fromJsonFunction

Function get fromJsonFunction
override

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

healthDataTypes

List<HealthDataType>? healthDataTypes
getter/setter pair

The health data types this section explains the need for.

Health data is not a single permission — Apple HealthKit and Android Health Connect authorise each data type separately — so listing RPPermissionType.health in permissions is not enough on its own. This is the list which is actually asked for, and it also documents in the consent document itself which health data the study reads.

Read access is requested for every type listed. Ignored unless permissions contains RPPermissionType.health; conversely, that permission resolves to RPPermissionStatus.unsupported if this is null or empty, since there would be nothing to ask for.

permissions

List<RPPermissionType>? permissions
getter/setter pair

The OS permissions which this section explains the need for.

They are requested when the participant taps "NEXT" on this section during a RPVisualConsentStep which has RPVisualConsentStep.askPermission set to true. This way the permission dialog is shown in context, with the summary and content of this section as the rationale — which is what both Apple and Google ask for.

If null or empty, no permissions are requested for this section.

summary

String summary
getter/setter pair

A short summary of the section. It appears during RPVisualConsentStep

title

String title
getter/setter pair

The title of the consent section which appears both in RPVisualConsentStep and RPConsentReviewStep.

type

RPConsentSectionType type
getter/setter pair

The type of the section.

The title and the image which is shown on the section card is associated to the type.

Methods

toJson

Map<String, dynamic> toJson()
override

Return a JSON encoding of this object.