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

outdatedDart 1 only

Automatic sourcecode generation for Dart

example/example.dart

library source_gen.example.example;

import 'package:source_gen/generators/json_serializable.dart';
import 'package:source_gen/generators/json_literal.dart';

part 'example.g.dart';

@JsonSerializable()
class Person extends Object with _$PersonSerializerMixin {
  final String firstName, middleName, lastName;
  final DateTime dateOfBirth;

  Person(this.firstName, this.lastName, {this.middleName, this.dateOfBirth});

  factory Person.fromJson(json) => _$PersonFromJson(json);
}

@JsonSerializable()
class Order extends Object with _$OrderSerializerMixin {
  int count;
  int itemNumber;
  bool isRushed;

  Order();

  factory Order.fromJson(json) => _$OrderFromJson(json);
}

@JsonSerializable(createToJson: false)
class Item {
  int count;
  int itemNumber;
  bool isRushed;

  Item();

  factory Item.fromJson(Map<String, Object> json) => _$ItemFromJson(json);
}

@JsonLiteral('data.json')
Map get glossaryData => _$glossaryDataJsonLiteral;
149
likes
0
pub points
97%
popularity

Publisher

verified publishertools.dart.dev

Automatic sourcecode generation for Dart

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

analyzer, args, cli_util, dart_style, path

More

Packages that depend on source_gen