listen 1.0.0-beta.2 copy "listen: ^1.0.0-beta.2" to clipboard
listen: ^1.0.0-beta.2 copied to clipboard

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

example/lib/main.dart

// Copyright 2013 The Flutter Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// ignore_for_file: avoid_print

import 'package:listen/listen.dart';

void main() {
  final counter = ValueNotifier<int>(0);

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

  counter.value = 1; // Prints: Counter changed to: 1
  counter.value = 2; // Prints: Counter changed to: 2

  counter.dispose();
}
4
likes
160
points
48
downloads

Documentation

API reference

Publisher

verified publisherflutter.dev

Weekly Downloads

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

Repository (GitHub)
View/report issues
Contributing

Topics

#state-management #listenable

License

BSD-3-Clause (license)

Dependencies

meta

More

Packages that depend on listen