Search packages, repositories and app categories

Package detailsv0.0.3

hydro

A simple, fast state management & service container solution for Flutter, without acrobatics.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
20
Likes
4
Pub points
160

Install package

flutter pub add hydro

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Hydro is a lightweight, high-performance state management and service container for Flutter, designed to simplify dependency injection and state handling without complex boilerplate or intricate patterns. It provides a clean, intuitive API for managing shared state and injecting services across the app. Built with simplicity in mind, Hydro reduces the need for extensive setup while maintaining scalability and type safety. Ideal for developers seeking a minimal yet powerful solution for organizing app logic and dependencies.

Use cases

  • Managing global app state
  • Injecting services across widgets
  • Simplifying dependency resolution
  • Streamlining state updates
  • Reducing boilerplate in large apps
  • Enabling testable architecture

Key features

  • Minimal API surface
  • Fast performance
  • Type-safe dependency injection
  • Built-in service lifecycle management
  • Supports all Flutter platforms
  • Easy integration with existing code

Suitable for

  • Small to medium-sized Flutter projects
  • Developers preferring simplicity over complexity
  • Teams wanting fast setup for state management
  • Apps requiring clean separation of concerns
  • Projects aiming for maintainable architecture

Considerations

  • Limited advanced features compared to full frameworks
  • Best suited for straightforward state needs
  • May require adaptation in highly complex state scenarios
  • Not ideal for apps needing deep customization of state flow

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

hydro

A simple state management & service container solution for Flutter.

Usage
import 'package:hydro/hydro.dart';
// inherit Hydro
class SomeClass extends Hydro {
  
  String _name = "inital value";
  
  // getter
  String get name => _name;
  
  // setter
  void setName(String newName) {
    _name = newName;
    update(); // NOTE: `update()` is important to refresh the UI.
  }
  
}
// Adding to the service container
// If already been added, nothing will change.
Hydro.set(SomeClass());

// OR

// force replace an existing service, set `forceReplace: true`
Hydro.set(SomeClass(), forceReplace: true);
class _SomePageState extends State<SomePage> {
 // ...   
     
SomeClass? some_class = Hydro.get<SomeClass>(this);
// OR
SomeClass some_class = Hydro.mustGet<SomeClass>(this);

// NOTE: `get` & `mustGet` methods accept an argument of type `State`,
// it is required to refresh the UI when changes occur;
// You may as well leave it empty if UI updates are NOT needed.
// SomeClass? some_class = Hydro.get<SomeClass>();

Categories

Dependencies

Dependency list 1 items

Source repository

Projects using this package

No data available yet.