gen_suite 0.0.1
gen_suite: ^0.0.1 copied to clipboard
A powerful code generation package.
β¨ gen_suite β Code generation utilities for Dart #
gen_suite is a compact, production-ready toolkit for Dart code generation.
It begins with a singleton generator and is built to grow with more tools as the dart_suite ecosystem expands.
π Why this package? #
- Say goodbye to boilerplate with safe, readable generated code.
- Write small abstract classes β get public APIs automatically.
- Extensible by design: more annotations and generators can be added later.
β‘ Core features #
-
Singleton generator for private abstract classes:
- Works with constructors (default, positional, optional, named, with defaults).
- Preserves parameter shape & defaults.
- Lazy, static-backed instance creation.
- Clear error messages for unsupported cases (e.g. generics, private-only).
-
Clean generation with
code_builder+source_gen.
π Quick start #
-
Add to
pubspec.yaml:dependencies: dart_suite: ^1.0.0 dev_dependencies: gen_suite: ^1.0.0 build_runner: ^2.6.0 -
Create a private abstract class:
import 'package:dart_suite/dart_suite.dart'; part 'my_service.g.dart'; @Singleton() abstract class _MyService { _MyService(this.apiKey, {this.timeout = 30}); final String apiKey; final int timeout; void doWork(); } -
Run generator:
dart run build_runner build -
Use the generated public wrapper (
MyService) in your app.
π± Extensibility #
Not limited to singletons! Future generators may include factories, adapters, and mappers.
Guidelines for adding new annotations:
- Keep them small and focused.
- Show clear errors for unsupported shapes.
- Always add tests + examples.
βοΈ Configuration #
- Customize with
build.yaml. - Use build_runner flags to control generation scope & formatting.
β Testing & examples #
- Run tests:
dart test - Generator tests:
dart run build_runner test - Check
example/folder for sample programs.
π€ Contribution #
- Open an issue with your idea.
- Add tests + examples for new generators.
- Keep APIs stable and document changes in
CHANGELOG.md.
π¬ Support #
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: rahulsharmadev0@gmail.com
π License #
MIT licensed β see LICENSE.
π Acknowledgements #
Thanks to dart_suite, build_runner, source_gen, and contributors for making this toolkit possible.