open 1.2.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 71

Open.dart #

Runtime Release License

Open whatever you want in Dart, such as URLs, files or executables, regardless of the platform you use.

Documentation #

Development #

License #

Open.dart is distributed under the MIT License.

Changelog #

Version 1.2.0

  • Raised the Dart SDK constraint.
  • Updated the package dependencies.

Version 1.1.0

  • Added a local instance of the xdg-open script version 1.1.3.

Version 1.0.0 #

  • Initial release.


import 'package:open/open.dart';

/// Demonstrates the usage of the `open()` function.
Future<void> main() async {
  // Open a URL in the default browser.
  await open('');

  // Open a URL in the given browser.
  await open('', application: 'firefox');

  // Open a URL in the given browser, using the specified arguments.
  await open('',
    application: 'chrome',
    arguments: ['--incognito']

  // Open an image in the default viewer
  // and wait for the opened application to quit.
  await open('funny.gif', wait: true);

Use this package as an executable

1. Install it

You can install the package from the command line:

$ pub global activate open

2. Use it

The package has the following executables:

$ open_cli

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  open: ^1.2.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:open/open.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jan 16, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4

Health suggestions

Fix lib/src/io/open.dart. (-1.49 points)

Analysis of lib/src/io/open.dart reported 3 hints:

line 22 col 7: DO use curly braces for all flow control structures.

line 30 col 7: DO use curly braces for all flow control structures.

line 55 col 13: DO use curly braces for all flow control structures.

Fix bin/open_cli.dart. (-0.50 points)

Analysis of bin/open_cli.dart reported 1 hint:

line 18 col 7: DO use curly braces for all flow control structures.

Fix lib/src/io/wsl.dart. (-0.50 points)

Analysis of lib/src/io/wsl.dart reported 1 hint:

line 7 col 5: DO use curly braces for all flow control structures.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0 <3.0.0
build_cli_annotations ^1.1.0 1.1.0
Transitive dependencies
args 1.5.2
Dev dependencies
build_cli ^1.3.5
build_runner ^1.7.2
build_test ^0.10.10
build_version ^2.0.1
grinder ^0.8.3
test ^1.9.4