getPlatformCustomUriScheme function
String
getPlatformCustomUriScheme({
- @Deprecated("Use 'applicationId' instead.") String? androidApplicationId,
- String? applicationId,
- int oauthRedirectPort = 10000,
Get the custom uri scheme of the app for the current platform.
Implementation
String getPlatformCustomUriScheme({
@Deprecated("Use 'applicationId' instead.") String? androidApplicationId,
String? applicationId,
int oauthRedirectPort = 10000,
}) {
// It is important to check for web first because web is also returning the TargetPlatform of the device.
if (!kIsWeb) {
if (defaultTargetPlatform == TargetPlatform.windows ||
defaultTargetPlatform == TargetPlatform.linux) {
// Apparently the customUriScheme should be the full uri for Windows and Linux for oauth2_client to work properly
return "http://localhost:$oauthRedirectPort";
} else if (defaultTargetPlatform == TargetPlatform.android ||
defaultTargetPlatform == TargetPlatform.iOS) {
return applicationId ?? androidApplicationId ?? defaultApplicationId;
}
}
return "http";
}