cooker 1.1.0

  • Readme
  • Changelog
  • Installing
  • 48

cooker #

A template based file generator for Dart.

You can use Cooker to generate source code file (or not). Cooker also support variables with flexible pattern.

Usage #

Bascic usage #

The usage can be very simple. Basically, you just need a template file path and a target file path.

import 'package:cooker/cooker.dart';

final templatePath = 'templates/';
final targetPath = 'doc/';

final cooker = Cooker(templatePath, targetPath);

Usage with variables #

The variables allows you to replace parts of text in the target file. You can enter a list of them and specify a pattern for replaces.

Some important notes:

  1. You can enter a variables pattern optionally. The default pattern is like {{%s}}.
  2. The variable value will be replaced on the %s space.
import 'package:cooker/cooker.dart';

final templatePath = 'templates/';
final targetPath = 'doc/';

final contentVariables = HashMap<String, String>();
contentVariables['author'] = 'danielxfr';
contentVariables['project'] = 'cooker';

final variablesPattern = '|%s|';

final cooker = Cooker(templatePath, targetPath, contentVariables: variables, variablesPattern: variablesPattern);

This code will be work good in a template like this:

Hello, my friend.

This is a |%s| project named as |%s|. You can see more about him on GitHub.

Thanks for use this.

Changelog #

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[Unreleased] #

[1.1.0] - 2019-12-12 #

Added: #

  • Usage documentation.

[1.0.2] - 2019-12-11 #

Fix: #

  • Invalid return types as "void".

[1.0.1] - 2019-12-09 #

Added: #

  • package compatibility.

[1.0.0] - 2019-12-09 #

First version with initial source code.

Use this package as a library

1. Depend on it

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

  cooker: ^1.1.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:cooker/cooker.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 Mar 24, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6

Health issues and suggestions

Document public APIs. (-1 points)

16 out of 16 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and cooker.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0