widgetbook_generator 0.0.1 widgetbook_generator: ^0.0.1 copied to clipboard
A package to automate setup and maintanance of the widgetbook package by using code generation.
Introduction #
package:widgetbook_generator allows to generate and setup code for package:widgetbook which makes using and maintaining Widgetbook easier.
Before you start #
We recommend reading the documentation of package:widgetbook before you start with this package.
Packages #
This package requires the following dependencies:
Package | Pub |
---|---|
package:widgetbook | |
package:widgetbook_annotation |
and the following dev dependencies:
Package | Pub |
---|---|
package:widgetbook_generator | |
package:build_runner |
The pubspec.yaml
file could look like this:
dependencies:
widgetbook:
widgetbook_annotation:
dev_dependencies:
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.