Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Implementation of url_launcher for the web
import 'dart:async';
import 'dart:html' as html;
import 'package:flutter/services.dart';
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
class UrlLauncherPlugin {
static void registerWith(Registrar registrar) {
final MethodChannel channel = MethodChannel(
const StandardMethodCodec(),
final UrlLauncherPlugin instance = UrlLauncherPlugin();
Future<dynamic> handleMethodCall(MethodCall call) async {
switch (call.method) {
case 'launch':
final String url = call.arguments['url'];
return _launch(url);
throw PlatformException(
code: 'Unimplemented',
details: "The url_launcher plugin for web doesn't implement "
"the method '${call.method}'");
bool _launch(String url) {
return, '') != null;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.