Skip to content
pubscout

listen

1.0.1, released 4 months ago by flutter.dev

A package to notify state changes to interested listeners in pure Dart.

WASM-readyRock solid
$ flutter pub add listen
Source repository

What it does

Provides ValueNotifier and ChangeNotifier in pure Dart to manage and notify state changes to listeners. Also allows merging multiple listenables together.

AI-written summary of version 1.0.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need simple state notification in pure Dart without Flutter dependencies
  • You want to use familiar patterns like ValueNotifier and ChangeNotifier outside of Flutter

Skip it when

  • You are building a complex Flutter app that benefits from full-featured state management like Riverpod or Bloc
  • You require advanced dependency injection or automated state rebuilding widgets

Strengths

  • Pure Dart support
  • Familiar API mirroring Flutter's ValueNotifier and ChangeNotifier
  • Supports merging multiple listenables

Weaknesses

  • Lacks advanced state management features like dependency injection or automated widget rebuilding out-of-the-box

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
1
void valueNotifierExample() {
  final counter = ValueNotifier<int>(0);

  counter.addListener(() {
    print('Value changed: ${counter.value}');
  });

  counter.value = 5;
  counter.dispose();
}

Alternatives

Packages that do the same job and could replace listen.

  • provider

    If you are working specifically in Flutter and want built-in widget tree integration for ChangeNotifier.

  • bloc

    For predictable state management driven by events and strict state streams.

Works with

Packages commonly used together with listen: ones it builds on, ones built on it, and its own family.