peek library

Peek shows the network logs your app already collects.

Import this library from application code: it re-exports the core model together with the Flutter user interface. Adapter packages should import package:peek/core.dart instead.

Classes

InMemoryPeekStore
A PeekStore that keeps at most maxEntries entries in memory.
Peek
The heart of Peek: the sink adapters report into and the store the UI reads from, with redaction and size limits applied in between.
PeekAction<T>
One option of a showPeekActions sheet.
PeekActiveFilters
What the list is filtered by right now, one removable chip per value.
PeekAdapter
An adapter that feeds a logger's output into Peek.
PeekArrivalsBar
Says how many calls arrived above the list while it was scrolled away, and takes the reader back to them.
PeekBinaryBodyView
Bytes Peek cannot show as anything else.
PeekBody
The body of a request or response — as much of it as Peek could capture.
PeekBodyTruncator
Cuts bodies down to a byte budget, keeping their size on the wire so they read as truncated rather than small.
PeekBodyView
A body, shown the way its kind deserves.
PeekBytesBody
A body held as raw bytes.
PeekClock
Source of the current time for everything Peek timestamps.
PeekController
The state behind Peek's screens: what the list shows and what is selected.
PeekCookie
One cookie from a Cookie request header or a Set-Cookie response header.
PeekCookiesView
The cookies of a request or a response, with their attributes.
PeekCopyButton
Copies text to the clipboard and says so.
PeekCurlExporter
Turns a request into a curl command that can be pasted into a shell.
PeekDateRange
A closed or half-open range of moments.
PeekDurationRange
A closed or half-open range of durations.
PeekEmptyBody
No body at all.
PeekEmptyState
What fills the screen when there is nothing to show.
PeekEntry
One network call as Peek shows it: the request, whatever came back, and when it all happened.
PeekEntryAdded
A new entry was added.
PeekEntryList
The scrolling list of calls, for a caller that wants a plain box.
PeekEntryRecorded
A whole call, reported at once by a source that only learns about calls after they end — a log history, say.
PeekEntryRemoved
An entry was removed, by hand or by eviction.
PeekEntryScreen
One call as a screen of its own, for layouts too narrow for a pane.
PeekEntrySliver
The calls as a sliver, for a screen that owns the scrolling.
PeekEntryTile
One network call as a row of the list.
PeekEntryUpdated
An existing entry was replaced.
PeekEntryView
One call in full, without a screen around it.
PeekErrorView
What stopped a call, in as much detail as the adapter gave.
PeekEvent
Something an adapter observed about a network call.
PeekEventReducer
Folds adapter events into a PeekStore.
PeekExporters
Every way Peek can hand an entry to something else.
PeekFacets
The values a filter can pick from, counted over a set of entries.
PeekFailure
What went wrong with a network call.
PeekFakeClock
A clock that only moves when told to.
PeekFilledButton
The one button on a screen that carries it: Resume, Show 12 requests.
PeekFilter
Which entries to show. Every criterion that is set must hold; an empty set, an unbounded range or an empty query means "any".
PeekFiltersSheet
Every criterion the recorded calls offer, one row each.
PeekFormBody
A form body: URL-encoded fields, or multipart fields and files.
PeekFormBodyView
The fields and files of a form.
PeekFormField
One name=value field of a form body.
PeekFormFile
One file part of a multipart body. Only metadata is kept: file contents are never captured.
PeekHarExporter
Writes entries as an HTTP Archive (HAR 1.2) document.
PeekHeaders
An immutable, case-insensitive multimap of HTTP headers.
PeekHeadersView
The headers of a request or a response, as a table.
PeekHighlightedText
text with every occurrence of highlight marked.
PeekIcon
One of Peek's glyphs, drawn at size in color.
PeekIconButton
One of the icons at the top of a screen.
PeekIconData
One glyph, as the outlines it is drawn from.
PeekIcons
Every glyph Peek draws, as outlines rather than a font.
PeekId
Identifies one network call across the events an adapter reports for it.
PeekImageBodyView
An image body, drawn and measurable.
PeekJsonNode
One value of a JSON document, with the path that leads to it.
PeekJsonRow
A node at the depth it is drawn.
PeekJsonTreeView
A JSON body as a tree that can be opened a branch at a time.
PeekKeyValue
One row of a PeekKeyValuesView.
PeekKeyValueRow
One name: value pair, the name over the value.
PeekKeyValuesView
A table of names and values: headers, cookies, query parameters.
PeekLimits
How much Peek keeps.
PeekListRow
One row of a grouped section: a name, what it holds, where it leads.
PeekListSection
A group of rows as one card, the way a settings screen groups them.
PeekMarkdownExporter
Writes an entry as Markdown, for an issue or a pull request.
PeekMediaType
A parsed Content-Type value such as application/json; charset=utf-8.
PeekMethodBadge
The HTTP method, in its own colour.
PeekOptions
How a Peek instance behaves.
PeekOverlay
A draggable button floating over the app that opens Peek.
PeekPill
A rounded label that can be chosen, counted and let go of.
PeekQuery
What the list shows: which entries, in which order.
PeekQueryParamsView
The query parameters of a URL, decoded.
PeekQuickBar
The quick views of the list and the order it is in.
PeekRedactionPolicy
Which headers, query parameters and body keys Peek masks before storing a call, so secrets never sit in memory or reach the screen.
PeekRedactor
Applies a PeekRedactionPolicy to what adapters report.
PeekRedirect
One hop of a redirect chain.
PeekRequest
The request half of a network call: what was sent.
PeekRequestFailed
A call that started earlier failed.
PeekRequestStarted
A request went out.
PeekResponse
The response half of a network call: what came back.
PeekResponseReceived
A response came back for a call that started earlier.
PeekRoute
The route showPeek pushes, for apps that build their own.
PeekScaffold
The frame every Peek screen sits in: a name, a row of actions, and the screen itself under them.
PeekScope
Hands the PeekController and the PeekStrings to the widgets below.
PeekScreen
The screen listing the calls Peek has recorded.
PeekSearchBar
The search field above the list, with the scopes it looks in.
PeekSearchField
The rounded field Peek searches from.
PeekSearchQuery
A case-insensitive text search over entries.
PeekSectionHeader
A heading above a group of rows.
PeekSegment<T>
One choice of a PeekSegmented.
PeekSegmented<T>
A row of pills, one of which may be chosen.
PeekSeparator
The hairline between rows, or between panes standing side by side.
PeekShareContent
Something Peek would like handed to the rest of the system.
PeekShareDelegate
Hands exported content to the platform's share sheet.
PeekSink
Where adapters send what they observe.
PeekSliverScaffold
A screen whose name is large until the content scrolls under it.
PeekSort
An order for entries.
PeekStatusDot
The coloured dot that opens a row, standing for its outcome.
PeekStatusLabel
How a call ended, as a dot and a few words in the colour of that outcome: 200 OK, Timed out, Pending.
PeekStore
Holds the entries Peek shows.
PeekStoreChange
What changed in a PeekStore.
PeekStoreCleared
Every entry was removed at once.
PeekStrings
Every word Peek shows, in one place.
PeekSurface
The ancestors every Peek screen and panel expects around it.
PeekSystemClock
The wall clock.
PeekTappable
A region that answers a tap, with Peek's own feedback.
PeekTextBody
A body held as text.
PeekTextBodyView
A body as text: numbered lines, a search that walks its matches, and only as much of it rendered as fits the screen.
PeekTextButton
A word that acts: Cancel, Clear filters, Reset.
PeekTextExporter
Writes an entry as plain text, for pasting into a chat or a ticket.
PeekTheme
Every colour, type style and measurement Peek draws with.
PeekTimings
How the time of a call was spent, phase by phase, for adapters that know.
PeekTimingView
Where a call's time went.
PeekUnavailableBody
A body that exists but was not captured.

Enums

PeekBodyMode
How a body that could be read either way is being read.
PeekBodyUnavailableReason
Why a body exists but was not captured.
PeekEntryAction
What a call's menu can do.
PeekEntryState
Where a call is in its life.
PeekFailureKind
Why a network call failed.
PeekJsonKind
What a node of a JSON document holds.
PeekReduction
What a PeekEventReducer did with an event.
PeekSearchScope
Where a PeekSearchQuery looks.
PeekSortField
What entries are ordered by.
PeekStatusClass
The class of an HTTP status code: its first digit.
PeekTitleStyle
How a screen wears its name.

Extensions

PeekNavigation on Peek
Opening Peek from the instance itself.

Constants

peekVersion → const String
The version of the peek package, as written into exports.

Functions

peekCopy(BuildContext context, String text) → Future<void>
Puts text on the clipboard and says so where context is.
peekHarContent(List<PeekEntry> entries, String subject, {Rect? origin}) → PeekShareContent
An HTTP Archive of entries, named after subject, shared from origin where the platform wants to know.
peekPlatformShareDelegate() → PeekShareDelegate?
What the platform can hand an export to without a delegate.
peekShareOrigin(BuildContext context) → Rect?
Where the widget at context sits on screen, in global coordinates.
showPeek(BuildContext context, {Peek? peek, PeekStrings strings = const PeekStrings(), PeekShareDelegate? share, bool fullscreenDialog = true, bool rootNavigator = true}) → Future<void>
Opens Peek over context and completes when it is closed.
showPeekActions<T>(BuildContext context, {required List<PeekAction<T>> actions, String? title, Widget? header}) → Future<T?>
Asks which of actions to take, in a sheet.
showPeekAlert(BuildContext context, {required String title, required String message, required String confirmLabel, bool destructive = true}) → Future<bool>
Asks before doing something that cannot be taken back.
showPeekBody(BuildContext context, {required PeekBody body, required String title}) → Future<void>
Pushes body over context, titled title.
showPeekDetail(BuildContext context, {required String title, required WidgetBuilder builder}) → Future<void>
Pushes what builder draws over context, as a screen titled title.
showPeekEntry(BuildContext context, PeekId id) → Future<void>
Pushes PeekEntryScreen for id over context.
showPeekEntryActions(BuildContext context, PeekEntry entry, {bool includePin = true}) → Future<void>
Offers what can be done with entry, and does it.
showPeekFilters(BuildContext context) → Future<void>
Opens PeekFiltersSheet over context as a modal sheet.
showPeekListActions(BuildContext context) → Future<void>
Offers what can be done with the list as it stands, and does it.
showPeekSheet<T>(BuildContext context, {required WidgetBuilder builder}) → Future<T?>
Shows builder in a panel rising from the bottom of the screen.
showPeekToast(BuildContext context, String message) → void
Says something happened, briefly, near the bottom of the screen.

Typedefs

PeekErrorHandler = void Function(Object error, StackTrace stackTrace)
Receives errors Peek swallowed so the app never sees them: an adapter that threw, an event the reducer dropped, a store that failed.

Exceptions / Errors

PeekDroppedEventException
An event the reducer refused, handed to PeekOptions.onError.