locationOfAppSchemeUri function
The location an "Open in app" URL names: <scheme>:///product?id=42 is
/product?id=42; <scheme>:////, <scheme>:/// and <scheme>:// are
/. Null for any other URL, including one on another scheme or with a
host.
Implementation
String? locationOfAppSchemeUri(Uri uri, String scheme) {
if (scheme.isEmpty || uri.scheme != scheme.toLowerCase()) return null;
if (uri.host.isNotEmpty || uri.userInfo.isNotEmpty || uri.hasPort) {
return null;
}
final path = uri.path.replaceFirst(RegExp(r'^/+'), '/');
return linkLocation(path.isEmpty ? '/' : path, uri.queryParameters);
}