impulse 0.7.0 copy "impulse: ^0.7.0" to clipboard
impulse: ^0.7.0 copied to clipboard

Minimalist state management and dependency injection.

example/impulse_example.dart

import 'package:impulse/impulse.dart';

final counterRef = Ref((store) => Counter());

class Counter extends ImpulseNotifier {
  int count = 0;

  void increment() {
    count += 1;
    notify();
  }
}

void main() async {
  $store.watch(counterRef, (count) => print('Count is $count'));

  $store.get(counterRef).increment();

  $store.reset();
}

void main() async {
  final result = await attempt(() => fetchData());

  if (result is AsyncFailure) {
    print('Fetch failed: ${result.error}');
    return;
  }

  print('Fetched value: ${result.value}');
}
1
likes
160
points
30
downloads

Documentation

API reference

Publisher

verified publishervanzwolsoftware.nl

Weekly Downloads

Minimalist state management and dependency injection.

Repository (GitHub)
View/report issues

Topics

#state #reactive #dependency-injection

License

MIT (license)

Dependencies

meta

More

Packages that depend on impulse