drip_core 0.1.1-alpha copy "drip_core: ^0.1.1-alpha" to clipboard
drip_core: ^0.1.1-alpha copied to clipboard

High-performance, zero-dependency reactive engine for the DRIP framework. Synchronous-only tracking with microtask coalescing.

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
0
points
454
downloads

Publisher

verified publisherappamania.in

Weekly Downloads

High-performance, zero-dependency reactive engine for the DRIP framework. Synchronous-only tracking with microtask coalescing.

Homepage
Repository (GitHub)
View/report issues

Topics

#state-management #reactive #signals #performance #flutter

License

unknown (license)

More

Packages that depend on drip_core