0 purchases
class generator
Dart Class Generator #
A toolkit providing builder-based library for dart code generation such as classes, methods, properties and constructors.
"I have used Dart to create Dart"
Features #
Generate classes, constructors, methods, properties with ease
Pre-made generation of copyWith, serialization (toMap, fromMap) and Equatable
Outputs everything as a simple string which you can then write to a file on your own
Attention! This does not work with Dart's build package. This is a standalone library written in Dart that builds Dart code.
Getting started #
Add the dependency to your pubspec.yaml file
class_generator: ^1.0.0
copied to clipboard
Import the dependecy in your code file
import 'package:class_generator/class_generator.dart';
copied to clipboard
Usage #
Build your first class
final name = Field('String', 'name', prefix: 'final');
final age = Field('int', 'age', prefix: 'final');
final builder = ClassBuilder('Human');
builder
..buildConstructor()
..buildCopyWith()
..addFields([name, age]);
print(builder.build());
copied to clipboard
Additional information #
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.