drip 0.0.1 drip: ^0.0.1 copied to clipboard
Minimalist chunked State Management for Flutter
DRIP #
Drip is a wrapper for InheritedWidget to be able to handle the state management using Streams. This is a personal project and is under-construction.
Features #
- Divide the handlers in small
DripActions
- Provider different widgets to react a new changes in the state
- Have the possibility to use Interceptor
Getting started #
Import this library into your project:
drip: ^latest_version
Usage #
DripProvider<DripCounter>(
create: (_) => DripCounter(),
child: DripCounterPage(),
)
class DripCounterPage extends StatelessWidget {
const DripCounterPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Dripper<DripCounter, int>(
builder: (context, state) => Text('Counter: ${state.count}'),
),
TextButton(
onPressed: () {
DripProvider.of<DripCounter>(context).increment();
},
child: const Text('Add +'),
),
]
),
),
);
}
}
class DripCounter extends Drip<int> {
DripCounter() : super(0);
void increment() {
print('Increment');
leak(state + 1);
}
}
Examples #
Flutter is a game-changing technology that will revolutionize not just development, but software itself. A big thank you to the Flutter team for building such an amazing platform 💙
Maintainers #
You are welcome to contribute :3
TODO #
- Create test
- Improve de readme
License #
MIT License
Copyright (c) 2023 James Cardona
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.