drip_core 1.0.0 copy "drip_core: ^1.0.0" to clipboard
drip_core: ^1.0.0 copied to clipboard

Pure Dart reactive state management with microtask batching and single-propagation-pass updates, with zero Flutter dependency.

example/drip_core_example.dart

import 'package:drip_core/drip_core.dart';

void main() {
  print('--- DRIP Core Example ---');

  // 1. Create a simple reactive state
  final counter = dripState(0, debugName: 'Counter');

  // 2. Create a derived computed state
  final isEven = DripComputed(
    () => counter.value % 2 == 0,
    debugName: 'IsEven',
  );

  // 3. Register a side effect
  DripEffect(() {
    print('Counter is ${counter.value} (Even? ${isEven.value})');
  });

  // 4. Update the state (this triggers the effect)
  print('Writing 1...');
  counter.write(1);

  print('Writing 2 and 3 synchronously...');
  // 5. Batch updates (only one effect trigger happens after microtask flush)
  counter.write(2);
  counter.write(3);
}
0
likes
160
points
454
downloads

Documentation

API reference

Publisher

verified publisherappamania.in

Weekly Downloads

Pure Dart reactive state management with microtask batching and single-propagation-pass updates, with zero Flutter dependency.

Repository (GitHub)
View/report issues

Topics

#state-management #reactive #dart #performance #computed

License

MIT (license)

Dependencies

meta

More

Packages that depend on drip_core