app property

CarpApp app

The configuration of the CARP server app.

Implementation

CarpApp get app {
  if (_app == null) {
    try {
      if (studyId == null) throw Exception("A study ID must be provided");
      if (studyId!.isEmpty) {
        throw Exception("The study ID cannot be empty - '$studyId'");
      }
    } catch (e) {
      throw Exception("A valid study ID is not provided");
    }
    _app = CarpApp(
      name: "CAWS @ DTU",
      uri: uri.replace(pathSegments: ['dev']),
      authURL: uri,
      clientId: clientId,
      clientSecret: clientSecret,
      redirectURI: Uri.parse('carp-studies-auth://auth'),
      discoveryURL: uri.replace(pathSegments: [
        ...uri.pathSegments,
        '.well-known',
        'openid-configuration'
      ]),
      studyId: studyId,
    );
    print(_app);
  }
  return _app!;
}