peek 2.1.1
peek: ^2.1.1 copied to clipboard
A beautiful in-app network inspector for Flutter: records the calls your client makes and shows them — searchable, filterable, exportable.
Changelog #
2.1.1 #
A live demo of Peek in the browser: artdima.github.io/peek. The code of the package is unchanged.
- The README links the demo, with a badge and a button under the intro.
- The example runs on the web as the demo page: an app on one phone and
Peek on the other, two views of one program over the same
Peek. Besides its scenarios, which the page calls the Playground, it has a sneaker shop whose server is pretended inside the app as a Dio adapter, so its calls are the same for every visitor.
2.1.0 #
More ways to share a call, redesigned sheets, empty states with a picture and a refreshed dark theme.
Upgrading from 2.0. Nothing breaks, but two things are worth a look. A
PeekShareDelegate that ignores PeekShareContent.kind sends text as a
file — handle PeekShareKind.text and PeekShareKind.file separately, as
the example does. A switch over PeekEntryAction that names every value
needs four more cases: shareUrl, shareCurl, shareText,
shareMarkdown.
PeekShareContent.kindsays what aPeekShareDelegateis handed:PeekShareKind.text— a URL, a command or a summary to paste where text goes — orPeekShareKind.file, a HAR or a session to attach. It defaults tofile, so a delegate written before this one goes on attaching everything; one that tells the two apart hands text to the platform as text, as the example now does withshare_plus. On the web, text goes through the browser's own share sheet where there is one (phones, Safari) and is saved as a file where there is not; a sheet closed without choosing shares nothing.- A call's sheet shares it as text, not only as a HAR, so a failing call
reaches a chat or a ticket in one step. The sheet is a table now: a row
per format — URL, cURL, Text, Markdown, HAR — with a Copy button at its
end and, where something can carry the call off (the app's
PeekShareDelegate, or the browser on the web), a Share button beside it. Above the table the call is named the way its tile names it, with the host, the outcome, the size and the time on a line of figures, and a redirected call shows its hops as a bar, a segment per hop in the colour of its status. Pin and Close are round buttons in the header; there is no Cancel row.peekEntryContentbuilds what a row shares for an app's own menu, in anyPeekEntryFormat;PeekEntryActiongainsshareUrl,shareCurl,shareTextandshareMarkdown;PeekIcons.copyis new andPeekIcons.shareis drawn as a tray an arrow leaves;PeekMethodBadgewithlargeis the pill that heads a sheet rather than a tile; andPeekStringsgainexportAs,formatUrl,formatCurl,formatText,formatMarkdown,formatHar,copyHar,redirectCount,shareUrl,shareCurl,shareTextandshareMarkdown. - The list's menu is laid out the same way: a Session badge and the count
at its head —
10 requests, or2 of 10 requestsunder a filter — the HAR row with its Copy and Share buttons, then a Session card with Save session and the way to Peek Pro, which now says where the link stands beside it:Not connected,Connected to Studio Mac, and so on.PeekBadgeis the pill at the head of a sheet (PeekMethodBadgewithlargeis one);peekDesktopMenuTitleandpeekDesktopMenuStatusgive an app's own menu the same row;PeekStringsgainsession,listTitleanddesktopNotConnected. - An empty list has a picture: a radar of three arcs sweeping out from a
point. While nothing has been recorded the centre is a green pulse —
Peek is listening, and the line under it says recording is on, or that
it is paused and the pulse goes grey — and when the search and the
filters have caught everything the arcs are dashed, with a stray dot
on each, a filter sits at the centre, the line counts what is hidden
(
All 6 requests are outside the current search and filters.) and Clear filters is a tinted button.PeekRadardraws the picture,PeekEmptyState.illustratedlays a screen out around one with larger type,PeekFilledButtongainstinted, andPeekStringsgainnoRequestsPausedHintandnoMatchesOf;noRequestsHintnow says that recording is on. - The dark theme's neutrals are redrawn with a cold cast: near-black
#0B0D10behind everything,#15181Dfor cards, chips and the search field, a hairline of white at 7 % that reads the same on any surface, and ink in three steps —#F3F5F7,#9AA3AD,#7A838D. The accent and the status hues are as they were. A sheet has colours of its own now,PeekTheme.sheetandPeekTheme.sheetCard(#1C2026and#242931in the dark; unset in the light, and unset in a theme of your own, whereelevatedgoes on lifting a card's colour instead). A pressed row tints with the ink rather than the fill, so it shows on a card too. - In the dark, a sheet rises off the screen instead of vanishing into it:
every sheet and alert now draws with
PeekTheme.elevated, which lifts each surface a step the way iOS does — the sheet takes a card's colour, a card on it a fill's, with the ink and the status hues unchanged — and leaves a light theme as it is.PeekThemeScopeis what puts a theme in force under a subtree, andPeekTheme.oflooks there before the app's registered extension.
2.0.0 #
Remote viewing: the calls Peek records can be watched live on a Mac, in
Peek Pro, through the new
peek_remote package — see
doc/remote.md.
Upgrading from 1.x. One change breaks code, and only code that
switches over PeekBody: it has a sixth kind, PeekRemoteBody. Add a
PeekRemoteBody() case — treating it like PeekUnavailableBody is a safe
start — and move the constraint to peek: ^2.0.0. Everything else is new.
- Breaking:
PeekBodyhas a sixth kind,PeekRemoteBody(PeekBody.remote) — a body that exists and can be had, but is held elsewhere: on the device, when a desktop viewer shows the calls. It knows its size and type and holds nothing else. AswitchoverPeekBodythat names every kind stops compiling; add a case for it (or a_case) — treating it likePeekUnavailableBodyis a safe start. The codec writes it as theremotebody kind, which readers before this one take for a body that was not captured. - New in the public API:
PeekBodyLoaderfetches aPeekRemoteBody, andPeekBodySidesays which half of a call a body is. Hand a loader toPeekScreen(orshowPeek,PeekRoute,Peek.open,PeekOverlay,PeekScope) and such a body shows its size and type with a Load body button; what the loader returns replaces the body in the store, so it is loaded once, and a failure offers Retry. Without a loader there is no button.PeekEntry.bodyOnandPeekEntry.withBodyreach a body by its side;PeekRemoteBodyViewand fivePeekStrings(remoteBody,loadBody,loadingBody,loadBodyFailed,retry) are new. - New in the public API:
PeekCodecwrites every part of a call as JSON-ready values and reads it back. Unlike HAR it loses nothing Peek knows — pending calls, the kind of a failure and its stack trace, pins, truncation, why a body is missing — and it reads leniently, so a newer writer's unknown keys and kinds do not break an older reader. Session files and remote viewing are built on it. - New in the public API: a session file.
PeekSessionWriterwrites aPeekSessionHeaderand then one line of JSON per call;PeekSessionReaderreads it back into aPeekSession. A broken line costs that line, not the file, and is counted inskipped; a later line of the same call replaces the earlier one, so a file can be appended to withPeekSessionCodec.encodeEntryas calls complete. Peek hands over text and never writes a file itself — where the lines go is up to the app. PeekOptions.namesays what the app calls itself in a saved session. Pure Dart cannot read an app's name, so without it a viewer shows the platform.- The list's menu saves a session: everything recorded, not only what the
list shows, as a
.peekfile named after the app and the time. It sits beside Share as HAR and appears where that does — with the app'sPeekShareDelegate, or as a download on the web.peekSessionContentbuilds the same file for an app's own menu;PeekIcons.downloadandPeekStrings.saveSessionare new. - The list's menu always offers Connect to Peek Pro, under its own
heading, and says where the link stands — connected, waiting, turned
away. With
peek_remoteattached it opens a sheet to pair from: the Macs heard on the network, an address to type, and the four-digit code Peek Pro shows, in four cells that take a pasted or autofilled code. A refused code shakes the cells; a Mac that does not answer, one that answers without Peek Pro, an address that leads nowhere and a dropped connection each say so. Withoutpeek_remotethe sheet says what Peek Pro is and how to add it. Export moved beside it and appears only when there is something to export. - New in the public API, for the link:
PeekDesktopLinkin the core — pure Dart, so the screen knows nothing ofpeek_remote, which implements it — withPeekDesktopLinkState,PeekDesktopLinkStatus,PeekDesktopDenial,PeekDesktopFailureandPeekDesktopFound. The screen finds the link amongPeek.adapters.PeekDesktopSetup,PeekDesktopLinkSheet,showPeekDesktop,peekDesktopLinkOf,peekDesktopMenuLabelandpeekDesktopAddressare the sheet's parts;PeekCodeFieldis the code cells on their own;PeekIcons.desktopand thePeekStringsthat start withdesktopare new. - Sheets rise above the keyboard, so a field in one stays in view.
1.4.0 #
Exports save themselves in a browser, and a wide layout gives the list and the call a bar each.
- On the web an export no longer needs a
PeekShareDelegate: without one Peek hands the file to the browser, which puts it where downloads go. An app that brings its own delegate still wins, andpeekPlatformShareDelegate()returns whatever the platform offers. The URL behind the file now outlives the click that started the download, so a large export arrives whole. - Side by side, each pane wears a bar of its own. The filters, the clearing, the pause and the list's menu sit on the line the way out is on, above the name; the call carries its own menu at the top of its pane; and the rule between the panes runs the full height of the window instead of starting below a bar that spanned both. The list pane is wider, so the four quick modes and the order fit on one line.
- A call's menu is named apart from the list's, in both layouts: 'Request actions' rather than a second 'More'.
- New in the public API:
peekPlatformShareDelegate(),PeekSeparator.vertical(),PeekScreen.listPaneWidthandPeekStrings.requestActions. - The README and the package description say plainly that Peek records the calls it shows, rather than describing it as a layer over someone else's logger.
1.3.0 #
The screen catches up with the work done on it every day.
- Recording pauses and resumes from the bar, and a card under the quick
bar says so while it is paused.
Peek.pauseChangesreports every change, so a pause the app asks for reaches the screen too. - The actions sheet sits flush against the bottom edge and groups what it offers into cards under their own headings; a call's sheet opens with the method as a tile beside its path and host.
- Each order in the sort menu wears a glyph, and an option no one chose reads quieter than an action.
- The filters sheet is one row per criterion: it says what it is narrowed to and opens a sheet of its own to change it, where values toggle with their counts. The button at the foot says how many requests are left.
- New in the public API:
PeekFilledButton,PeekAction.sectionandheaderonshowPeekActions,PeekIconButton.selected,PeekMethodBadge.large,PeekController.pause/resume, nine glyphs inPeekIconsand the strings that name all of it.
1.2.0 #
Released alongside peek_http, the adapter for package:http. The library
is unchanged; the README and the example app now show the new adapter.
1.1.0 #
Released alongside peek_chopper, the adapter for Chopper. Nothing in this
package changed.
1.0.0 #
The first release: a viewer for the network calls an app's own loggers already record. Peek never performs, intercepts or changes a request.
- A pure-Dart core —
package:peek/core.dart— with the model of a call (PeekEntry, request, response, headers, cookies, body, failure, timings), thePeekSink/PeekEventcontract adapters report into, an in-memory ring-buffer store with pinning, filtering, searching and sorting, and export as cURL, HAR 1.2, Markdown and plain text. - Optional redaction of headers, query parameters and body keys before a call is stored — off by default, one line to turn on — and size limits that truncate bodies UTF-8-safely and say so.
- A Flutter UI in the spirit of Pulse: a console with search, quick filters and a filter sheet; a call screen with bodies, headers, cookies, query parameters, errors and timing on screens of their own; a JSON tree and a raw text view; a share delegate the app wires to its own sharing package.
showPeek,PeekRouteandPeekOverlayfor opening it,PeekThemefor the look,PeekStringsfor the words. Its own icon set, drawn from outlines (Lucide, ISC) — no font, no assets, no dependencies beyond Flutter andmeta.
