best_theme_annotation 2.0.0
best_theme_annotation: ^2.0.0 copied to clipboard
Annotations for creating and managing theme color variables in Flutter applications.
Changelog #
All notable changes to this project will be documented in this file.
2.0.0 - 2026-06-19 #
Breaking Changes #
- Removed the
varsparameter from the@BestThemeannotation. - The generator now automatically discovers theme tokens using compile-time static field analysis.
- Manual variable registration is no longer required.
Added #
-
Support for automatic generation of:
BestColorBestTextStyleBestAsset
-
Improved compile-time performance.
-
Cleaner and more maintainable theme definitions.
-
Stronger type safety through static token discovery.
Migration Guide #
Remove the vars parameter from your annotation and define your theme tokens as static const fields inside the theme class.
Old (v1.x.x)
@BestTheme(
vars: ['primary', 'card'],
extensionName: 'myColors',
)
class MyTheme extends _$MyTheme {}
New (v2.0.0)
@BestTheme(
extensionName: 'myColors',
)
class MyTheme extends _$MyTheme {
static const primary = BestColor(
light: Colors.blue,
dark: Colors.indigo,
);
static const card = BestColor(
light: Colors.white,
dark: Colors.black,
);
}
1.0.0 - 2026-03-06 #
Added #
- Added
extensionNameparameter to@BestThemeannotation (default:'bestTheme'). Allows customizing theBuildContextgetter name generated for accessing theme colors. Example:@BestTheme(vars: [...], extensionName: 'appColors')→context.appColors.color1.
Changed #
@BestThemeannotation now requires the companionbest_theme_generator2.0.0which generates aThemeExtension-based class instead of the previous singleton approach.- Generated code now uses Flutter's
ThemeExtensionsystem (ThemeData.extensions) for proper light/dark theme integration withMaterialApp. - Replaced the old
ThemeMode-based singleton pattern withbuildLightTheme/buildDarkThemeoverridable hooks on the generated base class, allowing fullThemeDatacustomization.
0.0.1 - 2024-10-31 #
Added #
- Initial release of
best_theme_annotationpackage. @BestThemeannotation to define custom theme colors and modes.- Support for defining color variables that can be automatically generated with
best_theme_generator. - Ability to specify light and dark color values for each
DostyColor. - Flexible theme configuration with easy integration into theme management setups.
Fixed #
- N/A (First release)
Changed #
- N/A (First release)