isNativeOauthDeepLinkReturnUri function
true if returnUri uses a scheme other than http / https (e.g. myapp://oauth).
Recommended on mobile so the API does not redirect to a web page (onboarding / dashboard) but reopens the native app.
Implementation
bool isNativeOauthDeepLinkReturnUri(String? returnUri) {
final u = returnUri?.trim();
if (u == null || u.isEmpty) return false;
try {
final parsed = Uri.parse(u);
final s = parsed.scheme.toLowerCase();
return s.isNotEmpty && s != 'http' && s != 'https';
} catch (_) {
return false;
}
}