Peek class final

The heart of Peek: the sink adapters report into and the store the UI reads from, with redaction and size limits applied in between.

final peek = Peek(options: const PeekOptions(enabled: kDebugMode));
dio.interceptors.add(PeekDioInterceptor(peek));

report never throws: whatever goes wrong inside Peek reaches PeekOptions.onError instead of the app. One instance per app is the norm; Peek.instance provides a lazily created default for the one-line setup.

Implemented types
Available extensions

Constructors

Peek({PeekOptions options = const PeekOptions(), PeekStore? store})
Creates an instance. Peek owns store — its own in-memory one by default — and disposes it with itself.

Properties

adapters → List<PeekAdapter>
Adapters attached with attach, in order.
no setter
canPin → bool
Whether one more entry may be pinned under the limit in options.
no setter
hashCode → int
The hash code for this object.
no setterinherited
isDisposed → bool
Whether dispose has run.
no setter
isEnabled → bool
Whether events are recorded at all; see PeekOptions.enabled.
no setter
isPaused → bool
Whether recording is paused; events arriving meanwhile are dropped.
no setter
options → PeekOptions
How this instance behaves.
final
pauseChanges → Stream<bool>
Each change of isPaused, whoever asked for it: a screen listening here shows a pause the app itself requested.
no setter
pinnedCount → int
How many entries are pinned.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
store → PeekStore
Where entries live.
final

Methods

attach<T extends PeekAdapter>(T adapter) → T
Registers adapter so it shows up in adapters and is disposed with this instance. Returns it, for chaining.
clear() → void
Removes every entry, pinned ones included.
detach(PeekAdapter adapter) → void
Disposes adapter and forgets it.
dispose() → void
Disposes the adapters and the store. Safe to call twice; afterwards events are ignored and, if this was instance, a fresh one is created on next use.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
open(BuildContext context, {PeekStrings strings = const PeekStrings(), PeekShareDelegate? share, PeekBodyLoader? bodyLoader, bool fullscreenDialog = true, bool rootNavigator = true}) → Future<void>

Available on Peek, provided by the PeekNavigation extension

Opens this instance over context; see showPeek.
pause() → void
Stops recording until resume.
pin(PeekId id) → bool
Pins the entry with id so eviction skips it. Returns whether it is pinned afterwards: false for an unknown id or when canPin is not.
report(PeekEvent event) → void
Records event. Never throws.
override
reportAdapterError(Object error, StackTrace stackTrace) → void
Records that the adapter hit error while observing a call. Never throws.
override
resume() → void
Resumes recording after pause.
togglePin(PeekId id) → bool
Pins or unpins the entry with id; returns whether it is pinned afterwards.
toString() → String
A string representation of this object.
inherited
unpin(PeekId id) → void
Unpins the entry with id, if it is there.

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

instance ↔ Peek
The default instance, created on first use with default options. Assign one with custom options before anything reads it.
getter/setter pair