riverpod_sugar 1.0.1 copy "riverpod_sugar: ^1.0.1" to clipboard
riverpod_sugar: ^1.0.1 copied to clipboard

The sweetest way to use Riverpod! Revolutionary ScreenUtil-style extensions (.state, .text, .toggle) that turn verbose Riverpod code into concise one-liners. 80% less code, 10x faster development, zer [...]

Changelog #

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

1.0.1 - 2025-08-01 #

๐Ÿงน Documentation & Structure Improvements #

โœจ Enhanced

  • Complete documentation overhaul with comprehensive usage guides
  • Streamlined documentation structure - removed redundant files for clarity
  • Enhanced example documentation with practical implementation details
  • Improved method naming - all extensions now use descriptive names (e.g., increment() instead of inc)
  • Full freedom philosophy - emphasized flexibility over restrictive patterns

๐Ÿ—‘๏ธ Removed

  • Redundant documentation files - cleaned up duplicate markdown files
  • Restrictive widget patterns - removed forced patterns like ref.counter()
  • Abbreviated method names - replaced with clear, descriptive alternatives

๐Ÿ“š Documentation

  • COMPLETE_USAGE_GUIDE.md - comprehensive guide emphasizing user freedom
  • RIVERPOD_VS_SUGAR.md - detailed comparison with standard Riverpod
  • Enhanced README.md - streamlined main documentation
  • Updated example README - practical demo documentation

1.0.0 - 2025-08-01 #

๐Ÿš€ REVOLUTIONARY RELEASE: ScreenUtil-Style State Management! #

๐Ÿ”ฅ Game-Changing Features

  • Sugar Extensions - Revolutionary one-liner provider creation and state management
    • Instant Provider Creation: 0.state, "text".text, false.toggle, <String>[].items
    • Descriptive State Updates: counter.increment(ref), name.updateText(ref, "value"), toggle.toggle(ref)
    • Flexible Value Watching: ref.watchValue(provider), ref.readValue(provider), ref.updateValue(provider, value)
    • 80% Code Reduction: Transform verbose Riverpod into concise one-liners
    • ScreenUtil-Inspired API: Same simplicity as .w, .h, .r, .sp but for state management

โšก Core Widgets & Components

  • RxWidget Family

    • RxWidget - Simplified ConsumerWidget with buildRx() method
    • RxStatefulWidget & RxState - Stateful equivalent with clean syntax
    • RxBuilder - Inline reactive widget builder without creating new classes
    • RxShow - Conditional rendering based on provider state
  • AsyncValue Superpowers

    • AsyncValueSugar.easyWhen() - Simplified async state handling with auto loading/error
    • mapData() - Transform data while preserving async state
    • hasDataWhere() - Check conditions on async data
    • dataOrNull - Safe data access without exceptions
    • Smart getters: hasData, isLoading, hasError, errorOrNull
  • Complete Form Management

    • FormManager - StateNotifier for comprehensive form validation
    • FormState - Immutable form state with error tracking
    • CommonValidators - Production-ready validation functions:
      • required() - Required field validation
      • minLength() / maxLength() - Length validation
      • email() - Email format validation
      • pattern() - Regex pattern validation
      • range() - Numeric range validation
      • matches() - Field matching validation
      • combine() - Combine multiple validators

๐Ÿ› ๏ธ Advanced Utilities

  • Smart Debouncing

    • Debouncer - Simple input debouncing for search and API calls
    • AdvancedDebouncer - Advanced debouncing with leading/trailing/maxWait options
  • Intelligent Provider Combination

    • ProviderCombiners - Combine multiple providers elegantly:
      • combine2(), combine3(), combine4() - Combine providers into tuples
      • combineList() - Combine same-type providers into lists
      • map() - Transform provider values
      • where() - Filter provider rebuilds
    • AsyncProviderCombiners - Smart async provider combination with error handling

๐ŸŽฏ Sugar Extensions Reference

  • Provider Creation

    final counter = 0.state;           // StateProvider<int>
    final name = "John".text;          // StateProvider<String>
    final isDark = false.toggle;       // StateProvider<bool>
    final todos = <String>[].items;    // StateProvider<List<String>>
    final price = 19.99.price;         // StateProvider<double>
    
  • State Operations with Descriptive Names

    counter.increment(ref);           // Increment
    counter.decrement(ref);           // Decrement
    counter.addValue(ref, 5);         // Add value
    counter.resetToZero(ref);         // Reset to 0
    name.updateText(ref, "Jane");     // Update text
    name.clearText(ref);              // Clear text
    isDark.toggle(ref);               // Toggle boolean
    todos.addItem(ref, "New task");   // Add to list
    
  • Widget Building

    ref.counter(counter);             // Text widget showing count
    ref.txt(name);                    // Text widget showing string
    ref.show(isDark, MyWidget());     // Conditional widget
    ref.stepper(counter);             // +/- buttons with counter
    

๐Ÿ“ˆ Performance & Developer Experience

  • 80% Code Reduction: Turn 50-line Riverpod patterns into 10-line Sugar code
  • Zero Learning Curve: Familiar ScreenUtil-style API
  • Full Type Safety: Complete null safety and type inference
  • Production Ready: Extensive testing and real-world validation
  • Perfect Compatibility: Works alongside existing Riverpod code

Documentation

  • Comprehensive README with examples
  • API documentation for all public members
  • Complete example app demonstrating all features
  • Migration guide from standard Riverpod

Testing

  • Full test coverage for all components
  • Example tests for common use cases

Technical Details #

  • Dart SDK: >=3.0.0 <4.0.0
  • Flutter: >=3.10.0
  • Dependencies: flutter_riverpod ^2.4.9
  • Null Safety: โœ… Complete null safety support
  • Platforms: All Flutter platforms supported

Future Releases #

1.1.0 Planned Features #

  • RxListView - Reactive list widget with loading states
  • RxAnimatedSwitcher - Animated transitions between provider states
  • Navigation helpers for provider-aware routing
  • Performance optimization widgets
  • Additional common validators

1.2.0 Advanced Features #

  • DevTools integration for better debugging
  • Code generation macros for providers
  • Testing utilities and mock helpers
  • Advanced caching strategies
  • Background task management

Migration Notes #

From flutter_riverpod to riverpod_sugar #

This package is designed to be a drop-in enhancement to flutter_riverpod:

  1. No Breaking Changes: All existing riverpod code continues to work
  2. Gradual Adoption: Migrate widgets one at a time
  3. Zero Runtime Overhead: Sugar syntax compiles to standard riverpod calls
  4. Full Interoperability: Mix and match with existing ConsumerWidget code

Version Compatibility #

riverpod_sugar flutter_riverpod Flutter Dart
1.0.0 ^2.4.9 >=3.10.0 >=3.0.0

Contributing #

We welcome contributions! Please see our Contributing Guide for details.

Support #

6
likes
0
points
18
downloads

Publisher

verified publisherionicerrrrscode.com

Weekly Downloads

The sweetest way to use Riverpod! Revolutionary ScreenUtil-style extensions (.state, .text, .toggle) that turn verbose Riverpod code into concise one-liners. 80% less code, 10x faster development, zero learning curve. Complete with RxWidget, easyWhen, FormManager, smart debouncing, and intelligent provider combiners.

Repository (GitHub)
View/report issues

Topics

#flutter #riverpod #state-management #sugar-syntax #boilerplate-reduction

Documentation

Documentation

License

unknown (license)

Dependencies

flutter, flutter_riverpod

More

Packages that depend on riverpod_sugar