hydro 0.0.1-beta1 copy "hydro: ^0.0.1-beta1" to clipboard
hydro: ^0.0.1-beta1 copied to clipboard

outdated

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

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>();
4
likes
0
pub points
17%
popularity

Publisher

verified publisherfiras.dev.sy

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

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

collection, flutter

More

Packages that depend on hydro