With a local client side application, with
import 'dart:io';
I see no way to load up the consumers current default browser and then load a web page. (Locally stored HTML or a website)
I've searched the API documentation at http://api.dartlang.org yet have found no easy way.
Is there any way of doing this yet? Preferably similar to the Desktop class in java ?
I don't think there's a function for that. You can fill a new feature request.
If you need a workaround, you can deal with the Process and Platform classes.
start ${url}
.xdg-open ${url}
if xdg-open
is present.Here is a sample :
import 'dart:io';
main() {
final url = "http://dartlang.org";
if (Platform.operatingSystem == 'windows') {
Process.run("start", [url]);
} else if (Platform.operatingSystem == 'linux') {
Process.run("xdg-open", [url]);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With