build_it 0.2.0 copy "build_it: ^0.2.0" to clipboard
build_it: ^0.2.0 copied to clipboard

discontinued
outdated

The `build it`is a builder that makes publicly available third-party source code generators and runs them during the build process for rapid development.

example/example.dart

import 'dart:convert';
import 'dart:isolate';

import 'package:build_it/build_it_models.dart';

Future<void> main(List<String> args, [response]) async {
  if (response is! SendPort) {
    return;
  }

  if (args.length != 1) {
    throw ArgumentError('Wrong number of arguments');
  }

  final arg = jsonDecode(args[0]) as Map;
  final config = BuildConfig.fromJson(arg.cast());
  final data = jsonDecode(config.data);
  if (data == null) {
    final result = BuildResult(code: '// There is no data\n');
    response.send(jsonEncode(result.toJson()));
    return;
  }

  if (data is! Map) {
    throw StateError('Unexpected configuration data type: ${data.runtimeType}');
  }

  final name = data['name'];
  final code = <String>[];
  code.add('main() {');
  code.add('stdout.writeln("Hello, $name!");');
  code.add('}');

  final directives = <Directive>[];
  directives.add(Directive(type: 'import', url: 'dart:io'));

  final result = BuildResult(code: code.join('\n'), directives: directives);
  response.send(jsonEncode(result.toJson()));
}
1
likes
0
points
19
downloads

Publisher

unverified uploader

Weekly Downloads

The `build it`is a builder that makes publicly available third-party source code generators and runs them during the build process for rapid development.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

args, build, build_runner, code_builder, dart_style, json_annotation, json_serializable, meta, path, yaml

More

Packages that depend on build_it