getPlatformRedirectUri function
String
getPlatformRedirectUri({
- @Deprecated("Use 'applicationId' instead") String? androidApplicationId,
- String? applicationId,
- int oauthRedirectPort = 10000,
- String oauthRedirectPath = "/redirect.html",
Get the custom uri scheme of the app for the current platform.
Implementation
String getPlatformRedirectUri({
@Deprecated("Use 'applicationId' instead") String? androidApplicationId,
String? applicationId,
int oauthRedirectPort = 10000,
String oauthRedirectPath = "/redirect.html",
}) {
// It is important to check for web first because web is also returning the TargetPlatform of the device.
if (kIsWeb) {
return "${Uri.base.scheme}://${Uri.base.host}:${Uri.base.port}$oauthRedirectPath";
}
if (defaultTargetPlatform == TargetPlatform.android ||
defaultTargetPlatform == TargetPlatform.iOS) {
applicationId ??= androidApplicationId ?? defaultApplicationId;
return "$applicationId://";
}
return "http://localhost:$oauthRedirectPort$oauthRedirectPath";
}