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:
@@ -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'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user