Skip to content
This repository was archived by the owner on Oct 28, 2024. It is now read-only.

Add example to improve pub score. #6

Merged
merged 2 commits into from
Apr 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.1

- added example

## 0.1.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add ## 0.1.1 – added example


- initial release
27 changes: 27 additions & 0 deletions example/main.dart
Original file line number Diff line number Diff line change
@@ -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');
}
3 changes: 1 addition & 2 deletions lib/src/chrome.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ class Chrome {

/// 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,
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
homepage: https://github.com/dart-lang/browser_launcher
Expand Down