1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-10 14:58:34 +00:00

Add plugin and host registration to multiple_flutters example (#942)

This commit is contained in:
Jenn Magder
2021-10-29 09:41:23 -07:00
committed by GitHub
parent eb74d3f380
commit 05a3263eb4
7 changed files with 104 additions and 12 deletions

View File

@@ -4,6 +4,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:url_launcher/url_launcher.dart' as launcher;
void main() => runApp(const MyApp(color: Colors.blue));
@@ -90,6 +91,17 @@ class _MyHomePageState extends State<MyHomePage> {
},
child: const Text('Next'),
),
ElevatedButton(
onPressed: () async {
// Use the url_launcher plugin to open the Flutter docs in
// a browser.
const url = 'https://flutter.dev/docs';
if (await launcher.canLaunch(url)) {
launcher.launch(url);
}
},
child: const Text('Open Flutter Docs'),
),
],
),
),