openUri method
Loads content from a file or network URI.
Supported input patterns:
- "file:///path/to/file"
- "file://localhost/path/to/file"
- "http://example.com/path?query=1"
- "https://example.com/path?query=1"
Implementation
Future<void> openUri(Uri uri) {
final originalUri = uri;
if (!uri.isAbsolute) {
uri = Uri.parse(window.location.href).resolveUri(uri);
}
if (uri.scheme == 'file' && (uri.host.isEmpty || uri.host == 'localhost')) {
return openFile(File.fromUri(uri));
}
if (uri.scheme == 'http' || uri.scheme == 'https') {
return openHttp(uri: uri);
}
throw ArgumentError.value(originalUri, 'uri', 'Invalid URI scheme');
}