project_gen 0.0.1

  • Installing
  • Versions
  • 44


A simple scaffolding framework for Dart CLI tools. This makes it easier to get projects off the ground. It also depends on args and console, so those packages are available for your usage.


project_gen has a simple, callback-based structure, and ultimately just provides abstractions to create files within a project directory.

Placing your code in callbacks will ensure files are created in order. Directories are created first, and then files.

import 'dart:io';
import 'package:args/command_runner.dart';
import 'package:project_gen/project_gen.dart';

class InitCommand extends Command {
    String get name => 'init';

    String get description => 'Initializes a new project.';

    run() async {
        // New project in the current dir
        var project = new Project('<project-name>');'web', (web) async {
            // Clone a repo into a directory.
            // By default, the .git dir will be deleted.
            await web.clone('git://path/to/repo');
        });'views', (views) async {
            views.file('index.jade', (index) async {
                await index.copyResource('package:example/res/views/index.jade');
                await index.copyFile(new File('/path/to/file'));
  'admin', (admin) async {
                // Without a callback
                var foo = admin.file('foo.txt');

                // Access underlying `dart:io` File or Directory
                await someStream().pipe(;

        // Run all generators and actions, and also run `pub get`
        await project.generate();

        // Pre-build assets
        await, ['tool/build.dart']);

Maintaining Projects

The API's in project_gen only create directories/files if they do not exist, so they can be used to modify existing projects.

You generally will not need to use callbacks for existing projects.

import 'package:project_gen/project_gen.dart';

main() async {
    // Load project out of current dir
    var project = await Project.load();

    // Create file if it doesn't exist, otherwise just open the existing one
    var readme = project.file('');

1. Depend on it

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

  project_gen: "^0.0.1"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

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

3. Import it

Now in your Dart code, you can use:

import 'package:project_gen/project_gen.dart';
Version Uploaded Documentation Archive
0.0.1 Jan 5, 2017 Go to the documentation of project_gen 0.0.1 Download project_gen 0.0.1 archive
0.0.0 Jan 5, 2017 Go to the documentation of project_gen 0.0.0 Download project_gen 0.0.0 archive


This feature is new.
We welcome feedback.
More details: scoring.

We analyzed this package, and provided a score, details, and suggestions below.

  • completed on Feb 3, 2018
  • Dart: 2.0.0-dev.20.0
  • pana: 0.10.1


Describes how popular the package is relative to other packages. [more]
0 / 100
Code health derived from static analysis. [more]
99 / 100
Reflects how tidy and up-to-date the package is. [more]
74 / 100
Overall score:
Weighted score of the above. [more]


Detected platforms: other

Primary library: package:project_gen/project_gen.dart with components: io, mirrors.


  • Maintain

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

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

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

  • 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 project_gen.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.19.0
args ^0.13.7 0.13.7 1.3.0
console ^2.2.4 2.2.4
id ^1.0.0 1.0.16
intl ^0.14.0 0.14.0 0.15.2
mustache4dart ^1.0.0 1.1.0 2.1.0
pubspec ^0.0.14 0.0.15
resource ^2.0.0 2.1.2
Transitive dependencies
charcode 1.1.1
collection 1.14.5
concepts 0.2.0
either 0.1.8
logging 0.11.3+1
matcher 0.12.1+4
meta 1.1.2
option 1.2.0
path 1.3.9 1.5.1
pub_semver 1.3.2
quiver 0.21.4 0.28.0
quiver_iterables 1.0.1
source_span 1.4.0
stack_trace 1.9.1
string_scanner 1.0.2
stuff 0.0.7
typed_data 1.1.5
uri 0.11.1
utf 0.9.0+4
vector_math 1.4.7 2.0.5
yaml 2.1.13
yamlicious 0.0.5
Dev dependencies
test ^0.12.15