widgetbook_generator 2.1.1 widgetbook_generator: ^2.1.1 copied to clipboard
A package to automate setup and maintanance of the widgetbook package by using code generation.
package:widgetbook_generator allows to generate and setup code for package:widgetbook which simplifies using and maintaining Widgetbook.
Before you start #
Before you start with this package, we recommend to read the documentation of package:widgetbook or watch the videos What is Widgetbook and How to use Widgetbook.
Packages #
This package requires the following dependency:
Package | Pub |
---|---|
package:widgetbook_annotation |
and the following dev dependencies:
Package | Pub |
---|---|
package:widgetbook | |
package:widgetbook_generator | |
package:build_runner |
The pubspec.yaml
file could look like this:
dependencies:
widgetbook_annotation:
dev_dependencies:
widgetbook:
build_runner:
widgetbook_generator:
Annotations #
The generator works with the annotations documented at package:widgetbook_annotation.
Run the generator #
The generator defined in this package uses package:build_runner to generate the desired code.
You can execute the generator by running flutter pub run build_runner build
.
If you are making a lot of changes while developing, you can also run flutter pub run build_runner watch
so package:build_runner will listen for changes in the file system and update Widgetbook accordingly.
Start the generated app #
The generator will create the app.widgetbook.dart
file in the same directory as the file in which @WidgetbookApp
is used. For details about this, see the documentation of package:widgetbook_annotation.
Start the app by running flutter run lib/app.widgetbook.dart
.
Hot reloading #
Hot reloading of changes in Widgetbook works out of the box. For limitations see package:widgetbook.
Let us know how you feel about Widgetbook #
We are funded and aim to shape Widgetbook
to your (and your team's) needs. If you have questions, feature requests or issues let us know on Discord or GitHub. We're looking forward to build a community and discuss your feedback on our channel! 💙