Chuck Interceptor는 HTTP 요청과 응답을 가로채서 검사하기 위해 저장하는 Flutter 앱용 디버깅 도구입니다. 헤더, 본문, 타임스탬프를 포함한 네트워크 트래픽에 대한 세부 정보를 확인할 수 있는 간단한 UI를 제공합니다. 개발 및 테스트 단계에서 개발자에게 이상적인 도구로, 코드 수정 없이 API 통신 문제를 식별하는 데 도움을 줍니다. 이 도구는 인터셉터를 통해 기존 HTTP 클라이언트와 원활하게 통합됩니다.
사용 사례
API 호출 디버깅
요청/응답 데이터 검사
네트워크 동작 테스트
연결 문제 식별
백엔드 상호작용 모니터링
주요 기능
실시간 HTTP 요청 로깅
간단한 웹 기반 검사 UI
요청과 응답 둘 다 지원
Dio 또는 HttpClient와의 간편한 통합
크로스 플랫폼 호환성
적합한 대상
개발 모드에서의 Flutter 개발자
팀즈 디버깅 API 통합
모바일 앱 테스터
프론트엔드 엔지니어가 네트워크 문제를 진단하고 있습니다
고려 사항
생산 환경 사용을 위한 것이 아님
수동 활성화 필요
강한 사용 시 성능에 영향을 미칠 수 있습니다
로컬에서만 접근 가능한 UI
제한된 사용자 정의 옵션
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Chuck
Need anything Flutter related? Reach out
on LinkedIn
ChuckInterceptor is an HTTP Inspector tool for Flutter which helps debugging http requests. It
catches and stores http requests and responses, which can be viewed via simple UI. It is inspired
from Chuck
and Chucker.
Supported Dart http client plugins:
Dio
HttpClient from dart:io package
Any other client (http, chopper, retrofit, custom) via the client agnostic API
Features:
✔️ Detailed logs for each HTTP calls (HTTP Request, HTTP Response)
✔️ Inspector UI for viewing HTTP calls
✔️ Save HTTP calls to file
✔️ Statistics
✔️ Floating inspector button with live call counter
✔️ Support for top used HTTP clients in Dart
✔️ Client agnostic API - log calls from any HTTP client, zero extra dependencies
✔️ Enhanced error handling with comprehensive recovery
✔️ Shake to open inspector
✔️ HTTP calls search and filtering
✔️ Performance optimized with memory management
✔️ Comprehensive unit test coverage
✔️ Curl command generation for easy debugging
If you need to pass navigatorKey lazily, you can use:
chuck.setNavigatorKey(yourNavigatorKeyHere);
This is minimal configuration required to run Chuck. Can set optional settings in Chuck constructor,
which are presented below. If you don't want to change anything, you can move to Http clients
configuration.
Additional settings
You can enable/disable Chuck dynamically (e.g. disable in production builds for zero overhead):
Chuck chuck = Chuck(
enabled: kDebugMode, // Completely short-circuits in production
maxBodySize: 1024 * 1024, // 1 MB max payload body size
);
You can set showInspectorOnShake in Chuck constructor to open inspector by shaking your device (default disabled):
Chuck chuck = Chuck(showInspectorOnShake: true);
If you want to use dark mode just add darkTheme flag:
Chuck chuck = Chuck(darkTheme: true);
You can also customize the entire palette using ChuckThemeExtension:
If you want to limit max numbers of HTTP calls saved in memory, you may use maxCallsCount
parameter (default is 1000).
Chuck chuck = Chuck(maxCallsCount: 500);
If you want to change the Directionality of Chuck, you can use the directionality parameter. If
the parameter is set to null, the Directionality of the app will be used.
Chuck ships with ChuckButton — a draggable floating bubble which shows how many HTTP calls were
intercepted and opens the inspector when tapped. It replaces the local notification used by Chuck
2.x, so the package no longer depends on flutter_local_notifications (no notification
permission, no notification channel setup, smaller binary).
The bubble colour reflects the state of intercepted traffic: primary colour by default, orange while
requests are in flight, red when at least one call failed. Counts above 999 are shortened to 999+.
If you need more control, use the widget directly:
MaterialApp(
navigatorKey: chuck.navigatorKey,
builder: (context, child) => ChuckButton(
chuckCore: chuck.core,
visible: kDebugMode, // render the button only in debug builds
alignment: Alignment.bottomLeft, // start position
padding: constEdgeInsets.all(24), // distance from screen edges
draggable: true, // allow user to move the button
hideWhenEmpty: true, // hide until the first call is intercepted
child: child,
),
home: constHomeScreen(),
);
The button is hidden automatically when Chuck is disabled (Chuck(enabled: false)).
If you prefer your own UI, listen to the calls stream and build whatever you want:
Any other client (http, Chopper, Retrofit, custom)
Chuck does not depend on package:http or any other client. Instead it takes plain values
(method, uri, headers, body, status code), so every client can be inspected through the same API.
For a client which hands you the finished call, log it in one step:
You may need that if you won't use the floating button or shake:
chuck.showInspector();
Saving and Sharing calls
Chuck supports saving and sharing HTTP call logs directly via the system share sheet (share_plus). No storage permissions (WRITE_EXTERNAL_STORAGE) are required.
Extensions
You can use extensions to shorten your http client code:
See complete example
here: https://github.com/SunnatilloShavkatov/chuck_interceptor/blob/master/example/lib/main.dart
To run project, you need to call this command in your terminal:
flutter pub run build_runner build --delete-conflicting-outputs