leancode_contracts_generator 0.12.0 copy "leancode_contracts_generator: ^0.12.0" to clipboard
leancode_contracts_generator: ^0.12.0 copied to clipboard

Dart contracts client generator for a CQRS API.

leancode_contracts_generator #

Installation #

dart pub add leancode_contracts_generator --dev

Usage #

First run will take longer due to the need to download external dependencies.


First initialize a config file filled with defaults with dart run leancode_contracts_generator init, then generate client contracts code with dart run leancode_contracts_generator.

$ dart run leancode_contracts_generator --help
Command line utility for generating dart CQRS contracts

Usage: leancode_contracts_generator <command> [arguments]

Global options:
-h, --help    Print this usage information.

Available commands:
  init   Initialize a config file

Run "leancode_contracts_generator help <command>" for more information about a command.

Library #

import 'dart:io';

import 'package:leancode_contracts_generator/leancode_contracts_generator.dart';

Future<void> main(List<String> arguments) async {
  final generator = ContractsGenerator(
      input: GeneratorScript.path(['ExampleContracts/**']),
      name: 'cool_name',
      output: Directory('lib'),
      extra: '// :)',
      include: RegExp(r'\w+(\.\w+)*'),

  await generator.writeAll();