api_studio 1.3.1
api_studio: ^1.3.1 copied to clipboard
In-app API inspector for Flutter: capture Dio, http or custom requests with redaction, edit & replay, cURL/HAR/Postman export, performance monitor and cloud logs.
Changelog #
1.3.1 #
✨ Added #
initialize(uploadLogs: false)uses the API key only for crash reports and performance telemetry, without uploading API logs. Useful for production apps whose request bodies belong to your users.
1.3.0 #
✨ Added #
- Crash reporting (opt-in):
ApiStudio.initialize(enableCrashReporting: true)reports uncaught Flutter and Dart errors to the portal's new Issues page, where they are grouped by stack trace with event and affected-user counts. Your existingFlutterError.onError/PlatformDispatcher.onErrorhandlers are still called. Requires anapiKey. - Each crash carries breadcrumbs: the API calls (method, URL without query string, status, duration) and, with
ApiStudioNavigatorObserver, the screens that led up to it. ApiStudio.captureException(error, stackTrace: ..., tags: ..., extra: ..., fingerprint: ...)for errors you catch yourself, andApiStudio.addBreadcrumb(...)for your own notes.- Crash reports are queued on disk and sent on the next launch if the app dies first. The same error is sent at most 3 times per launch.
- Pair it with alert rules in the portal (new issue, regression, crash spike, API failure spike → Slack, Discord or a webhook).
1.2.0 #
⚠️ Behavior changes #
- Performance and Files are now opt-in add-ons. API Logs are the core; the other tabs only appear with
ApiStudio.initialize(features: {ApiStudioFeature.performance, ApiStudioFeature.fileExplorer}).enablePerformanceMonitoring: truestill adds the Performance tab. With no add-ons the API Studio screen has no bottom bar.showPerformanceInspector/showFileExplorerkeep working when called directly.
✨ Added #
- Cloud logs carry a per-launch
ApiStudio.sessionId, device/OS info, app version/build/flavor (initialize(appVersion:, appBuild:, appFlavor:)), the tester (ApiStudio.setUser(...)), query parameters, request/response sizes, the truncated flag and the SDK version.
🐛 Fixed #
- Failed requests never reached the cloud dashboard. Network failures, timeouts and cancellations have no status code; the backend rejected them and the SDK silently discarded them. They are now uploaded.
- Uploaded logs used the upload time instead of the request time.
- A revoked key or rate limit (401/403/429) discarded every pending log; the queue is now kept and retried with backoff.
failedApiCountonly counted errors among the newest 20 logs.flush()returned early while another upload was in flight.
⚡ Performance #
- Pending cloud uploads are persisted on disk (survive crashes and kills) and sent in gzip batches of up to 50 instead of one request per log.
- Request/response bodies are stored in a separate lazy box and only read when a log is opened or exported, so they no longer sit in your app's memory.
- Large bodies (> 32 K characters or big JSON trees) are encoded, redacted and truncated on a background isolate.
- Opening a large body in the inspector formats it off the UI thread and shows a 64 KB preview with "Show all".
- JSON/TXT/HAR/Postman exports are redacted and encoded on a background isolate (your custom redaction still applies).
- New logs arriving while you're scrolled down no longer collapse the list back to the first page.
- The File Explorer stats files and counts folder contents concurrently; an unreadable folder no longer fails the whole listing.
- Add-on tabs are built only when first opened; log lookups by id are O(1); list refreshes are coalesced; performance snapshots aren't built when nothing listens.
- Search also matches HTTP method and exact status code.
🔧 Changed #
ApiStudio.sessionId,ApiStudio.setUser(...),ApiStudio.featuresandApiStudioFeatureare new public API.GetLogsParamsgainedincludeBodies(defaulttrue).- Storage schema 3: existing logs are migrated in place on first launch.
SlackProviderdocuments that its webhook URL ships inside your app.- CI: analysis of the companion packages runs only in their own jobs, and info-level lints are non-fatal (newer Flutter flags every
package:flutter/material.dartimport as deprecated in favour ofpackage:material_ui, which can't be adopted while Flutter 3.27 is supported).
1.1.0 #
⚠️ Behavior changes — please read #
- API Studio is now disabled in release builds by default.
ApiStudio.initialize()has a newenabledmaster switch that defaults tokDebugMode. When it is off, every API is a no-op: no local storage, no timers, no frame callbacks, no network calls, no UI. To keep using API Studio in QA/profile/release builds, passenabled: true. - Sensitive data is now redacted before it is stored locally, not just before upload, and also in cURL and every export. Values are replaced with
***REDACTED***. Because headers likeAuthorizationare now stored redacted, Edit & Run shows a warning and you must re-enter those values before replaying. - Remote upload now replaces sensitive headers with
***REDACTED***instead of dropping them, and also redacts JSON body keys and query parameters. - Retention: the default
maxStoredLogsdropped from 10,000 to 500. Logs older than 7 days (logRetention) are pruned automatically, and total stored body size is capped at ~50 MB. - Body limit: the per-body limit went from 64 K characters to 1 MB (
maxBodyBytes). Truncated bodies are flagged and end with an explicit marker. - The minimum SDK is now Dart 3.6 / Flutter 3.27. These were already required in practice by
url_launcher ^6.3.2; the old constraints were inaccurate. show,showNavigation,showFileExplorerandshowPerformanceInspectorare no-ops untilinitialize()has completed successfully. Previously they could open screens that crashed on uninitialized storage.
✨ Added #
- First-class Dio and http support via two optional companion packages, so
dio/httpare never forced on users who don't need them:api_studio_dio:dio.interceptors.add(ApiStudioDioInterceptor());api_studio_http:ApiStudioHttpClient(inner: http.Client())- Both capture URL, method, headers, query, body (incl. multipart descriptors), status, response headers/body, duration, error and stack trace. They handle cancelled requests, timeouts, and binary or oversized bodies, and use the same pipeline as
ApiStudio.log.
RedactionConfig(redactHeaders,redactBodyKeys,includeDefaults,redactorhook) viaApiStudio.initialize(redaction: ...). Body keys are matched recursively and case-insensitively, ignoring_/-.ApiStudio.initialize(enabled:, logRetention:, maxBodyBytes:, redaction:, navigatorKey:).ApiStudio.isEnabled,ApiStudio.redaction,ApiStudio.maxBodyBytes.ApiStudio.log(...)gainedformData,isMultipart,cancelled,requestSizeBytes,responseSizeBytes.ApiStudio.navigatorKeyandApiStudio.open(), to open API Studio without aBuildContext.ApiStudio.showFloatingButton([context])/hideFloatingButton(): a draggable debug button.- HAR 1.2 and Postman Collection v2.1 exports, alongside JSON and TXT.
ApiLogEntity.isTruncated.SECURITY.md, and a README "Privacy and data" section.
🔧 Changed #
- Storage moved from the unmaintained
hive/hive_flutter2.x tohive_ce. The on-disk format is compatible, and existing logs are migrated automatically: logs from ≤ 1.0.7 are re-redacted in place on first launch. Unreadable or corrupt boxes are cleared instead of crashing the app. API Studio no longer calls the globalHive.init, so a host app's own Hive home directory is left alone. - Every capture path (
ApiStudio.log, interceptors,ApiStudioClient, Edit & Run) now goes through one pipeline: redact → truncate → store → notify → upload. ApiStudioClientis now documented as an optional client for manual testing. Interceptors are the recommended path.- Edit & Run now works for requests captured by any integration. It preserves repeated query keys, flattens multi-value headers, and drops stale
Content-Length/Hostheaders. It also warns when the captured request had redacted values, multipart files or a truncated body. - Export file names changed from
api_inspector_logs.*toapi_studio_logs.*. - Stricter static analysis (
strict-casts,strict-inference,strict-raw-types, and more), with internal widgets now fully typed. - Removed the
hive_generatorandbuild_runnerdev dependencies. The Hive adapter is now hand-written and tolerant of missing or mistyped fields.
🗑️ Deprecated #
ApiStudio.init(...): useApiStudio.initialize(...). It still works and now delegates toinitialize. Will be removed in 2.0.0.ApiStudio.initClient(...)(deprecated since 1.0.6): useApiStudio.initialize(baseUrl: ...).
🐛 Fixed #
- Log eviction removed the entry with the lexicographically-first UUID key, not the oldest log. Eviction is now by timestamp.
- Install snippet in the README referenced
^1.0.6. - Broken emoji in the README "Export Logs" heading.
- The package description claimed built-in Dio interception that didn't exist.
- Tests no longer make real network calls to the API Studio backend.
