Skip to content

puntbyte/preferences_workspace

Repository files navigation

Preferences Workspace

style: lint License: MIT

This project helps you manage user settings and application state in Dart and Flutter. It's a code generator that writes the boring, repetitive settings code for you, so you don't have to.

Stop worrying about typos in storage keys and manually converting data types. This tool creates a simple, tailor-made class for your project that makes managing preferences safe and easy.

Key Benefits

  • Forget Typos: All your setting keys are generated for you. Your code editor will catch any mistakes at compile-time, not crash your app at runtime.
  • Use Any Storage: Works with your favorite storage solution. Whether you use shared_preferences, Hive, secure storage, or something else, the setup is simple.
  • Automatic Data Conversion: Forget about manually converting complex data like dates, times, colors, or your own custom classes. The generator handles the conversion to and from a storable format for you.
  • Highly Customizable: Start with simple presets that match your needs, or fine-tune everything. You can even set a project-wide convention, like making all storage keys snake_case, in a single line of configuration.
  • Ready for Reactive UIs: Easily build user interfaces that update automatically whenever a setting changes, without needing complex state management code.

The Simple Workflow

Using the tool is a straightforward, three-step process:

  1. Define a Blueprint You create a single, simple file where you list all the settings you need, like username or isDarkMode, and their starting values. This is your single source of truth.

  2. Run the Generator You run a standard command in your terminal.

  3. Use Your Custom Class The generator instantly creates a class that is perfectly tailored to your blueprint. You can now get and set preferences with simple, easy-to-read methods, and your code editor will help you avoid any mistakes.

Packages in this Workspace

This project is managed with Melos.

Package Description
preferences_generator The main tool that generates your code. This is where you'll find the primary user documentation.
preferences_annotation A lightweight helper package that provides the building blocks for your blueprint file.

Examples

Example Description
flutter_example A complete Flutter application demonstrating a reactive settings screen.
console_example A command-line application showcasing all features in a pure Dart environment.

For Contributors

Contributions are welcome! To get started with the development environment for this monorepo, follow these steps.

  1. Activate Melos: (You only need to do this once)

    dart pub global activate melos
  2. Bootstrap the workspace: This command links all local packages together and installs their dependencies.

    melos bootstrap
  3. Run common tasks: Use these commands to run tasks across all packages in the workspace.

    # Run all tests
    melos test
    
    # Run the code generator for all packages
    melos generate
    
    # Run static analysis
    melos analyze

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages