orchestrator 0.8.0 copy "orchestrator: ^0.8.0" to clipboard
orchestrator: ^0.8.0 copied to clipboard

A Dart package which can be used to programatically generate Dart code.

example/main.dart

import 'package:orchestrator/orchestrator.dart';

void main() {
  const element = Class(
    name: 'Cat',
    extends_: TypeReference('Animal'),
    constructors: [
      Constructor(
        isConst: true,
        parameters: [
          Parameter(
            name: 'name',
            isToThis: true,
          ),
          Parameter(
            name: 'state',
            isToThis: true,
            assign: Static('CatState.eating'),
          ),
        ],
      ),
    ],
    fields: [
      Field(
        name: 'name',
        type: TypeReference('String'),
        modifier: FieldModifier.final_,
      ),
      Field(
        name: 'state',
        type: TypeReference('CatState'),
        modifier: FieldModifier.final_,
      ),
    ],
  );

  const context = Context(useTraillingCommas: true);
  const emitter = ClassEmitter(context);

  emitter.emit(element);
}
0
likes
0
pub points
0%
popularity

Publisher

verified publisheriruoy.nl

A Dart package which can be used to programatically generate Dart code.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

collection, dart_style

More

Packages that depend on orchestrator