observables (1.0.0)
Installation
dart pub add observables:1.0.0 --hosted-url=About this package
Dart.Package.Observables
Observed value/collection/dictionary wrappers with change notification (ported from the old platform).
Quick start
import 'package:observables/observables.dart';
final value = Observed<String>('initial');
value.subscribe((v) => print('changed to $v'));
value.value = 'updated'; // fires the subscriber
final items = ObservedCollection<String>();
items.subscribe((item, action) => print('$action: $item'));
items.add('a');
final table = ObservedDictionary<String, int>();
table.add('count', 1);
ObservedDictionary depends on
Dart.Package.Logging
to log (without rethrowing, unless handleExceptions is false) when a
subscriber throws.
Project structure
pubspec.yaml
Version.txt
lib/
├── observables.dart public API — exports
└── src/
├── observable.dart Observed<T>
├── observed_collection.dart ObservedCollection<T>
└── observed_dictionary.dart ObservedDictionary<TKey, TValue>
test/
└── observables_test.dart
example/
└── example.dart
Versioning and publishing
Version.txt is the exact version that gets published — a push to main
publishes it only when that version isn't on the feed yet. Pushes to any
other branch only resolve and test.
Depends on dajno_logging (Dart.Package.Logging, renamed to avoid a pub.dev name collision) — pinned to ^1.0.0 on the
Forge Pub feed, not the old platform's git: dependency on
git.coldpixl.com.
CI
.forgejo/workflows/build.yml installs the Dart SDK, resolves dependencies,
and runs dart test on every push. On main, it also publishes via
dart pub publish, tags the commit v<version>, and creates a matching
Release — via the shared
Platform/Forgejo.Package.Actions/dart-publish
composite action. .forgejo/workflows/cleanup.yml removes prerelease Pub
versions when their branch is deleted.
Because this package depends on another private package on the Forge Pub
feed, build.yml has an extra step before dart-publish that installs a
throwaway Dart SDK just to run dart pub token add against the feed with
PACKAGES_TOKEN — the dart-publish action itself doesn't configure pub
credentials, so dart pub get 401s on any private dependency without this.
(Packages with no private dependencies, like Dart.Package.Logging itself,
don't need this step.)