studyId property

String? get studyId

The ID of the study.

The study ID is extracted from the application data of the invitation.

Implementation

String? get studyId {
  if (_studyId != null) return _studyId;
  if (invitation.applicationData == null) return null;

  if (invitation.applicationData is String) {
    // The application data is a plain String, so we can return it directly.
    _studyId = invitation.applicationData as String;
  } else {
    if (invitation.applicationData is Map<String, dynamic>) {
      // The application data is JSON, so we can to parse it.
      final appData = invitation.applicationData! as Map<String, dynamic>;
      _studyId = appData['studyId'] as String?;
    }
  }
  return _studyId;
}