unsaved_changes library
Detects unsaved changes on editable Flutter surfaces by diffing live state against a captured baseline, and reports what changed.
Classes
-
BaselineSource<
T extends Object> - Where a tracker learns that the saved state it should compare against has been replaced — typically the provider or bloc holding the server's copy.
-
ChangeDetector<
C, K extends Object> -
Captures a baseline from
Cand reports how the live state differs. -
ChangeSet<
K extends Object> - An immutable read-model over the changes a tracker currently reports.
-
ChangeTracker<
C, K extends Object> - Reports whether an editable surface still matches the state it was loaded with, and what differs.
- ChangeTrackerObserver
- Observes a tracker's lifecycle — for logging, breadcrumbs, or tests.
-
CollectionDetector<
C, K extends Object, T> - Reports items added to, removed from, or edited inside a keyed collection.
-
DetectorSession<
C, K extends Object> - A baseline captured by a ChangeDetector, able to diff against itself.
-
Facet<
T, K extends Object> - One comparable aspect of a value, and the change kind it reports.
-
FieldGroup<
C, K extends Object> - A set of fields that report one change kind between them.
-
FieldGroupDetector<
C, K extends Object> - Reports a change per FieldGroup whose fields no longer match the baseline.
- ItemSnapshot
- What a keyed collection captured for one item.
-
MembershipDetector<
C, K extends Object> - Reports keys entering or leaving a set — "which items has the user staged a resolution for", "which rows are selected".
- PayloadDigest
- The baseline for a PayloadDigestDetector: a canonical payload string, or a marker saying the payload cannot be diffed.
-
PayloadDigestDetector<
C, K extends Object> - A safety net: digests the whole request payload and reports a change when it moves at all.
-
SnapshotChangeDetector<
S, C, K extends Object> -
A ChangeDetector that captures a value of type
Sand compares against it — the shape almost every detector wants. - StreamSignal
- Adapts a Stream to a Listenable, so stream-based state (a bloc) can drive anything that expects a listenable.
-
TrackedChange<
K extends Object> - A single difference between the captured baseline and the live state.
- TrackerOptions
- Tuning for a tracker.
-
ValueStreamDetector<
C, S, K extends Object> -
Compares facets of a single value read from
C— a bloc state, a view model, a controller — and subscribes to the stream that publishes it.
Enums
- CommonChangeKind
- A ready-made change-kind enum for surfaces that do not need a bespoke one.
- DetectorRole
- How a tracker treats the changes a detector reports.
- MembershipDelta
- Which side of a membership change to report.
Functions
-
defaultEquals(
Object? a, Object? b) → bool - Compares two captured values, descending into lists, maps, and sets.
-
nullableStringEquals(
Object? a, Object? b) → bool -
Treats
nulland the empty string as the same value. -
streamBaseline<
T extends Object> ({required T? read(), required Stream< Object?> stream, Object? revisionOf(T value)?}) → BaselineSource<T> -
Builds a BaselineSource from stream-based state — a bloc, a
ValueStream, anything that republishes the saved copy.