dartx 0.0.8

  • README.md
  • Installing
  • Versions
  • 0


The main purpose of dartx is that it allows easy to execute special standalone command-line scripts at any place. These scripts can to require for their operation other packages (uses import directives). They will be executed without requirements manually to install these dependent packages.

Dartx does not have any dependencies and can be distributed with a command-line scripts.

Dartx supports the command-line scripts that contains pubspec.yaml files inside the source code of these scripts.

Example of command-line script (example/serve.dart):

name: serve
description: A sample static server
  shelf: any
  shelf_static: any

import "dart:async";
import "dart:io";
import 'package:shelf/shelf_io.dart' as shelf_io;
import "package:shelf_static/shelf_static.dart";

void main() {
  var path = Directory.current.path;
  var handler = createStaticHandler(path, defaultDocument: "index.html");
  var port = 8080;
  var address = InternetAddress.LOOPBACK_IP_V4;
  shelf_io.serve(handler, address, port).then((server) {
    var address = server.address.address;
    var port = server.port;
    var url = "http://$address:$port";
    print("Static web server (shelf)");
    print("Url: $url");
    print("Path: $path");
    print("Press <ENTER> to exit");
    stdin.listen((data) {
      server.close(force: true);

    Timer.run(() => runBrowser(url));

void runBrowser(String url) {
  var fail = false;
  switch (Platform.operatingSystem) {
    case "linux":
      Process.run("x-www-browser", [url]);
    case "macos":
      Process.run("open", [url]);
    case "windows":
      Process.run("explorer", [url]);
      fail = true;

  if (!fail) {
    print("Start browsing...");

To see it in action perform the following steps:

  1. Go to the dartx/example directory.
  2. Run command $DART_SDK/bin/dart ../bin/dartx.dart serve.dart.

Static web server will be executed even it uses shelf and shelf_static packages but dartx package does not declare in its pubspec.yaml these dependencies.

Principle of operation is very simple:

Before executing script dartx creates temporary directory and tells pub to get dependencies into this temporary directory.

Temporary directory will be deleted after the end of execution of command-line script.

Use this package as a library

1. Depend on it

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

  dartx: ^0.0.8

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

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

Version Uploaded Documentation Archive
0.0.8 Jan 11, 2017 Go to the documentation of dartx 0.0.8 Download dartx 0.0.8 archive
0.0.7 Jan 6, 2015 Go to the documentation of dartx 0.0.7 Download dartx 0.0.7 archive
0.0.6 Jan 5, 2015 Go to the documentation of dartx 0.0.6 Download dartx 0.0.6 archive
0.0.5 Jul 28, 2014 Go to the documentation of dartx 0.0.5 Download dartx 0.0.5 archive
0.0.3 Jul 4, 2014 Go to the documentation of dartx 0.0.3 Download dartx 0.0.3 archive
0.0.2 Jul 4, 2014 Go to the documentation of dartx 0.0.2 Download dartx 0.0.2 archive
0.0.1 Jul 3, 2014 Go to the documentation of dartx 0.0.1 Download dartx 0.0.1 archive
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.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Maintenance issues and suggestions

Add SDK constraint in pubspec.yaml. (-50 points)

For information about setting SDK constraint, please see https://www.dartlang.org/tools/pub/pubspec#sdk-constraints.

Maintain CHANGELOG.md. (-20 points)

Changelog entries help clients to follow the progress in your code.

Package is getting outdated. (-89.86 points)

The package was released 99 weeks ago.

Package is pre-v0.1 release. (-10 points)

While there is nothing inherently wrong with versions of 0.0.*, it usually means that the author is still experimenting with the general direction of the API.

The description is too long. (-10 points)

Search engines will display only the first part of the description. Try to keep it under 180 characters.

Maintain an example.

None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use dartx.dart. Packages with multiple examples should use example/readme.md.


Package Constraint Resolved Available
Dev dependencies
path any