widgetbook_annotation
3.11.0, released 9 months ago by widgetbook.io
Annotations for widgetbook_generator to build Flutter widgets in isolation.
What it does
Provides annotations used alongside widgetbook_generator to define use-cases and configure components for Widgetbook. It is part of the tooling used for developing UI components in isolation.
AI-written summary of version 3.11.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You are setting up Widgetbook for component development in Flutter
- You use widgetbook_generator to automatically generate your Widgetbook app structure
Skip it when
- You are not using Widgetbook or code generation for your UI components
- You are looking for state management or runtime UI packages
Strengths
- Simplifies Widgetbook setup with declarative annotations
- Integrates seamlessly with build_runner and widgetbook_generator
Weaknesses
- Requires build_runner and code generation steps
- Provides only annotations; requires the companion generator and core packages to function
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
Add to pubspec.yaml alongside build_runner and widgetbook_generator.
import 'package:widgetbook_annotation/widgetbook_annotation.dart';
@UseCase(name: 'Default', type: MyWidget)
Widget buildMyWidgetUseCase(BuildContext context) {
return MyWidget();
}Alternatives
Packages that do the same job and could replace widgetbook_annotation.
- build
Package for authoring build_runner compatible code generators.
87Compare - copy_with_extension
Annotation for generating copyWith extensions code using copy_with_extension_gen.
87Compare - drift_dev
Generates Dart database code from Drift table definitions as a dev‑dependency.
84Compare - json_serializable
Automatically generate code for converting Dart classes to and from JSON.
94Compare
Works with
Packages commonly used together with widgetbook_annotation: ones it builds on, ones built on it, and its own family.