SmartFhirClient.fromLaunchParameters constructor
SmartFhirClient.fromLaunchParameters(})
Constructor to assist in building a client from Launch parameters that may be present in the launch URL
Implementation
factory SmartFhirClient.fromLaunchParameters(
Uri base,
Map<String, String> queryParameters, {
FhirUri? fhirUri,
String? clientId,
FhirUri? redirectUri,
String? customUriScheme,
List<String>? scopes,
String? authorizeUrl,
String? tokenUrl,
String? launch,
String? secret,
String redirectPath = '/redirect.html',
}) {
fhirUri ??= queryParameters['iss'] == null
? throw Exception('no fhirUri was passed for SMART launch')
: FhirUri(queryParameters['iss']);
launch ??= queryParameters['launch'];
clientId ??= queryParameters['clientId'];
redirectUri ??= FhirUri(Uri(
host: base.host,
scheme: base.scheme,
port: base.port,
path: redirectPath,
));
if (clientId == null) {
throw Exception('no clientId was passed for SMART launch');
}
return SmartFhirClient(
fhirUri: fhirUri,
clientId: clientId,
redirectUri: redirectUri,
customUriScheme: customUriScheme,
scopes: scopes,
authorizeUrl: authorizeUrl == null ? null : FhirUri(authorizeUrl),
tokenUrl: tokenUrl == null ? null : FhirUri(tokenUrl),
launch: launch,
secret: secret,
isDemo: queryParameters['demo'] == 'true',
);
}