Add example to improve pub score. (dart-lang/browser_launcher#6)
diff --git a/pkgs/browser_launcher/CHANGELOG.md b/pkgs/browser_launcher/CHANGELOG.md index 6da5766..5ce8990 100644 --- a/pkgs/browser_launcher/CHANGELOG.md +++ b/pkgs/browser_launcher/CHANGELOG.md
@@ -1,3 +1,7 @@ +## 0.1.1 + +- added example + ## 0.1.0 - initial release
diff --git a/pkgs/browser_launcher/example/main.dart b/pkgs/browser_launcher/example/main.dart new file mode 100644 index 0000000..a586de4 --- /dev/null +++ b/pkgs/browser_launcher/example/main.dart
@@ -0,0 +1,27 @@ +import 'package:browser_launcher/browser_launcher.dart'; + +const _googleUrl = 'https://www.google.com/'; +const _googleImagesUrl = 'https://www.google.com/imghp?hl=en'; + +Future<void> main() async { + // Launches a chrome browser with two tabs open to [_googleUrl] and + // [_googleImagesUrl]. + await Chrome.start([_googleUrl, _googleImagesUrl]); + print('launched Chrome'); + + // Pause briefly before opening Chrome with a debug port. + await Future.delayed(Duration(seconds: 3)); + + // Launches a chrome browser open to [_googleUrl]. Since we are launching with + // a debug port, we will use a variety of different launch configurations, + // such as launching in a new browser. + final chrome = await Chrome.startWithDebugPort([_googleUrl], debugPort: 8888); + print('launched Chrome with a debug port'); + + // When running this dart code, observe that the browser stays open for 3 + // seconds before we close it. + await Future.delayed(Duration(seconds: 3)); + + await chrome.close(); + print('closed Chrome'); +}
diff --git a/pkgs/browser_launcher/lib/src/chrome.dart b/pkgs/browser_launcher/lib/src/chrome.dart index 7f1250b..c1c4084 100644 --- a/pkgs/browser_launcher/lib/src/chrome.dart +++ b/pkgs/browser_launcher/lib/src/chrome.dart
@@ -60,8 +60,7 @@ /// Starts Chrome with the given arguments and a specific port. /// - /// Only one instance of Chrome can run at a time. Each url in [urls] will be - /// loaded in a separate tab. + /// Each url in [urls] will be loaded in a separate tab. static Future<Chrome> startWithDebugPort( List<String> urls, { int debugPort,
diff --git a/pkgs/browser_launcher/pubspec.yaml b/pkgs/browser_launcher/pubspec.yaml index 8780aba..1375c6e 100644 --- a/pkgs/browser_launcher/pubspec.yaml +++ b/pkgs/browser_launcher/pubspec.yaml
@@ -1,7 +1,7 @@ name: browser_launcher -description: A standardized way to launch web browsers. +description: A package that provides a standardized way to launch web browsers. -version: 0.1.0 +version: 0.1.1-dev author: Dart Team <misc@dartlang.org> homepage: https://github.com/dart-lang/browser_launcher