value_broadcast 1.0.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 63

value_broadcast #

Analog for the Flutter's listenable (valueNotifier) in pure Dart used for console applications without flutter desktop embedding.

Getting Started #

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

[1.0.3] - Minor code optimization #

[1.0.2] - Added "clearListeners()" function #

[1.0.0] - Initial Release #

example/example.dart

import 'package:value_broadcast/value_broadcast.dart';

void main(){
  final ValueBroadcast<int> valueBroadcast = ValueBroadcast(1)..addListener(switchIndex);
  valueBroadcast.value = 1; //Will not trigger listeners
  valueBroadcast.value = 3;
  valueBroadcast.value = 2;
  valueBroadcast.value = 1;
  valueBroadcast.clearListeners();
}

void switchIndex(final int index) => print("Switching index to $index");

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  value_broadcast: ^1.0.3

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:value_broadcast/value_broadcast.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
25
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
63
Learn more about scoring.

We analyzed this package on Mar 26, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6

Health suggestions

Format lib/value_broadcast.dart.

Run dartfmt to format lib/value_broadcast.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.3.0 <3.0.0
Dev dependencies
test 1.9.3