diff --git a/packages/url-launcher/example/lib/main.dart b/packages/url-launcher/example/lib/main.dart index a81a3bb0ef4e..86018261b4ac 100644 --- a/packages/url-launcher/example/lib/main.dart +++ b/packages/url-launcher/example/lib/main.dart @@ -28,7 +28,7 @@ class MyHomePage extends StatefulWidget { class _MyHomePageState extends State { void _launchUrl() { - UrlLauncher.launch("https://flutter.io"); + launch('https://flutter.io'); } @override @@ -54,4 +54,4 @@ class _MyHomePageState extends State { ), ); } -} \ No newline at end of file +} diff --git a/packages/url-launcher/lib/url_launcher.dart b/packages/url-launcher/lib/url_launcher.dart index 1e02a9589e64..cef7d7a82a2d 100644 --- a/packages/url-launcher/lib/url_launcher.dart +++ b/packages/url-launcher/lib/url_launcher.dart @@ -2,12 +2,11 @@ import 'dart:async'; import 'package:flutter/services.dart'; -class UrlLauncher { - static const MethodChannel _channel = - const MethodChannel('plugins.flutter.io/URLLauncher'); - - /// Parse the specified URL string and delegate handling of the same to the - /// underlying platform. - static Future launch(String urlString) => - _channel.invokeMethod('UrlLauncher.launch', urlString); +/// Parse the specified URL string and delegate handling of the same to the +/// underlying platform. +Future launch(String urlString) { + return const MethodChannel('plugins.flutter.io/URLLauncher').invokeMethod( + 'UrlLauncher.launch', + urlString, + ); }