PackageTrack
Sign in Get early access

best_theme_generator

A code generation package for creating theme color variables in Flutter.

3.0.5 dosty17/best_theme

What this package is like to depend on

Last release 2 months ago

19 Jun 2026

Release timing varies

gaps range from 2 weeks to 8 months

Some releases are documented

notes for 15 of 27 stable releases

Nothing withdrawn

no release was ever pulled

2 years old

27 releases · first in 2024

22 releases in the last 12 months

see the full history below

Release timeline

27 releases · Dec 2024 to Jun 2026
2025 2026
Release Pre-release

Releases

latest 27
  1. 3.0.5 19 Jun 2026
    Release notes

    Fixed

    • Fix some problems
    Open source →
  2. 3.0.4 19 Jun 2026

    Nothing published for this version

  3. 3.0.3 19 Jun 2026

    Nothing published for this version

  4. 3.0.2 19 Jun 2026

    Nothing published for this version

  5. 3.0.1 19 Jun 2026
    Release notes

    Fixed

    -A bug fixed

    Open source →
  6. 3.0.0 19 Jun 2026
    Release notes

    Breaking Changes

    • Migrated the code generation engine to parse theme tokens directly from static const class fields.
    • Removed the legacy annotation-driven variable collection mechanism.
    • Removed internal runtime parameter maps and array-based token registration.
    • Eliminated factory constructors that relied on dynamic token arrays.
    • Reduced runtime allocations and removed lookup-related null reference issues.

    Added

    • Automatic detection and generation of:

      • BestColor
      • BestTextStyle
      • BestAsset
    • Multi-token grouping support for colors, typography, and assets.

    • Asynchronous storage lifecycle support through BestThemeStorage.

    • Automatic theme mode persistence integration.

    • Improved generated state management architecture.

    • Safe extension bundling after custom theme overrides.

    • Generated extensions are now appended after buildLightTheme() and buildDarkTheme() execution, preventing accidental loss of generated theme extensions.

    • Improved compile-time performance and code generation reliability.

    Fixed

    • Full compatibility with Analyzer 6.x and 7.x.
    • Fixed AST scanning issues caused by analyzer API changes.
    • Fixed build failures related to the fields2 architecture migration.
    • Improved generator stability across newer Dart SDK versions.

    Migration Guide

    Old (v2.x.x)

    final colors = [
      BestColor(
        name: 'primary',
        light: Colors.blue,
        dark: Colors.indigo,
      ),
    ];
    
    class MyTheme extends _$MyTheme {
      MyTheme() : super(myColors: colors);
    }
    

    New (v3.0.0)

    @BestTheme(
      extensionName: 'appTheme',
    )
    class MyTheme extends _$MyTheme {
      static const primary = BestColor(
        light: Colors.blue,
        dark: Colors.indigo,
      );
    
      static const titleLarge = BestTextStyle(
        light: TextStyle(fontSize: 24),
        dark: TextStyle(fontSize: 24),
      );
    
      static const appLogo = BestAsset(
        light: 'assets/logo_light.png',
        dark: 'assets/logo_dark.png',
      );
    }
    

    Open source →
  7. 2.0.0 06 Mar 2026
    Release notes

    Breaking Changes

    • Complete architecture redesign: Generator now produces a ThemeExtension-based class (_${ClassName}Theme extends ThemeExtension) instead of the previous singleton pattern. Generated code is no longer compatible with 1.x usage.
    • Removed: singleton (init(), instance), ValueNotifier/ThemeParam, BestThemeProvider, BestThemeBuilder, static color getters, and the context.BestTheme() / context.BestThemeRouter() wrappers.
    • Removed: toggleColor(), toDark(), toLight(), toSystem(), adanceToggle() instance methods.

    Added

    • ThemeExtension generation: generates @immutable _${ClassName}Theme extends ThemeExtension with copyWith, lerp, .light(colors) factory, .dark(colors) factory, and static of(context).
    • ${ClassName}BestThemeMaterial widget: standalone StatefulWidget — no object instantiation needed. Pass it a builder: (context, mode, lightTheme, darkTheme) and use directly as the app root.
    • buildLightTheme / buildDarkTheme overridable hooks on the generated _$ClassName base class. Receives the pre-built ThemeData (with extension already injected) so users can copyWith fonts, color schemes, app bar themes, etc. without re-declaring extensions.
    • extensionName annotation support: reads extensionName from @BestTheme to name the BuildContext getter (e.g. context.appColors).
    • New BuildContext extension methods: toDark(), toLight(), toggleTheme(), setThemeMode(mode), isDark, scaffoldBackgroundColor, primary, primaryScheme.

    Changed

    • Color access moved from context.myColors.colorName to context.{extensionName}.colorName via Flutter's Theme.of(context).extension<_${ClassName}Theme>().
    • Theme state is now managed by StatefulWidget (_${ClassName}BestThemeMaterialState) instead of a ValueNotifier singleton — fully compatible with Flutter's widget lifecycle.
    Open source →
  8. 1.2.0 15 Dec 2025
    Release notes
    • Fix issue of set theme mode from ThemeData
    Open source →
  9. 1.1.0 15 Nov 2025
    Release notes
    • you can use context.BestTheme also for routers
    Open source →
  10. 1.0.9 29 Oct 2025

    Nothing published for this version

  11. 1.0.8 29 Oct 2025

    Nothing published for this version

  12. 1.0.7 29 Oct 2025

    Nothing published for this version

  13. 1.0.6 29 Oct 2025

    Nothing published for this version

  14. 1.0.5 29 Oct 2025

    Nothing published for this version

  15. 1.0.4 29 Oct 2025

    Nothing published for this version

  16. 1.0.3 29 Oct 2025

    Nothing published for this version

  17. 1.0.2 29 Oct 2025
    Release notes
    • Fix issue of generating
    Open source →
  18. 1.0.1 29 Oct 2025
    Release notes
    • Use last best_theme version
    Open source →
  19. 1.0.0 29 Oct 2025
    Release notes
    • Updated dependencies for better compatibility and stability
    • Improved support for modern Flutter and Dart projects
    • Cleaned up pubspec.yaml
    Open source →
  20. 0.0.9 27 Sep 2025

    Nothing published for this version

  21. 0.0.8 27 Sep 2025

    Nothing published for this version

  22. 0.0.7 09 Sep 2025
    Release notes

    Added

    • Singleton Pattern Implementation: Implemented singleton pattern with init() and instance getters for better memory management
    • Context Extensions Generation: Auto-generates BuildContext extensions for seamless theme access
    • Static Color Getters: Generated static methods for accessing colors (get[ColorName])
    • Enhanced Router Support: Improved BestThemeRouter method with comprehensive MaterialApp.router support
    • Performance Optimizations: Better initialization and memory management patterns
    • Rich Documentation: Enhanced inline documentation and code comments in generated files

    Changed

    • BREAKING: Complete architecture redesign from object-based to context-based approach
    • Generated Code Structure: Completely restructured generated code for better organization
    • API Surface: Transformed from manual instantiation to automatic singleton management
    • Initialization Process: Changed from constructor-based to static initialization pattern
    • Color Access Pattern: Moved from wrapper widgets to direct context access via extensions

    Improved

    • Type Safety: Enhanced null safety and assertion handling in generated code
    • Developer Experience: Significantly simplified usage patterns with context extensions
    • Code Generation Quality: Better formatted and organized generated code
    • Error Handling: Improved error messages and debugging information
    • Runtime Performance: Optimized theme switching and color access patterns

    Enhanced

    • Code Aesthetics: Beautiful header with generation timestamp and developer credits
    • Documentation Generation: Comprehensive inline documentation for all generated methods
    • Method Signatures: Improved method signatures and parameter handling
    • Extension Methods: Rich set of BuildContext extensions for theme management
    • Class Structure: Better organized class hierarchy and method grouping

    Technical Improvements

    • Generated Header: Added decorative ASCII art header with metadata
    • Singleton Management: Implemented proper singleton pattern with lazy initialization
    • Context Integration: Deep integration with Flutter's BuildContext system
    • Static Analysis: Better code generation for static analysis tools
    • Memory Management: Improved memory usage patterns in generated code

    Generated Features

    • context.myColors.[colorName] - Direct color access
    • context.isDark - Theme state checking
    • context.toggleTheme() - Theme toggling
    • context.BestTheme() - App wrapper creation
    • context.BestThemeRouter() - Router app wrapper
    • Static color getters for each defined color
    • Automatic singleton initialization
    Open source →
  23. 0.0.6 24 Jan 2025
    Release notes

    Changed

    • enhancements
    Open source →
  24. 0.0.5 19 Jan 2025
    Release notes

    Changed

    • fix issue
    Open source →
  25. 0.0.4 19 Jan 2025
    Release notes

    added

    • Add custom colors to main class

    Changed

    • Support latest analyzer
    Open source →
  26. 0.0.3 29 Dec 2024
    Release notes

    Changed

    • support go router
    Open source →
  27. 0.0.2 25 Dec 2024
    Release notes

    Added

    • Initial release of best_theme_generator package.
    • Support for generating theme classes based on annotations.
    • Automatic variable generation for color themes defined in DostyColor.
    • @BestTheme annotation to create theme structures with light and dark modes.
    • Generated code for easy access to defined colors via variable names.
    • Support for theme mode toggling (light, dark, system) in the generated class.

    Fixed

    • N/A (First release)

    Changed

    • N/A (First release)
    Open source →

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive