RPConsentSection constructor Null safety

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

Returns a populated object with the given type.

It is enough to provide only the type of the section, the title is automatically filled out. If a title is provided, that title is used instead. summary is set to null initially.

If creating a custom section, a title must be provided.

Implementation

RPConsentSection(
    {required this.type,
    String? title,
    this.summary,
    this.content,
    this.dataTypes,
    this.customIllustration}) {
  assert(type != RPConsentSectionType.Custom || title != null,
      "If a you are creating a Custom ConsentSection, then a title must be provided.");
  this.title = (type == RPConsentSectionType.Custom)
      ? title!
      : (title != null)
          ? title
          : _titleForConsentSectionType(type);
}