ChuckCore class

Core class that manages HTTP call interception, storage, and UI navigation.

This class provides the main functionality for:

  • Intercepting and storing HTTP requests/responses
  • Managing notifications for new HTTP calls
  • Handling shake-to-open functionality
  • Memory management with configurable call limits
  • Navigation to the inspector UI

The class uses RxDart's BehaviorSubject for reactive state management, ensuring that UI components automatically update when new HTTP calls are added.

Constructors

ChuckCore(GlobalKey<NavigatorState>? navigatorKey, {required bool showNotification, required bool showInspectorOnShake, required String notificationIcon, required int maxCallsCount})
Creates Chuck core instance

Properties

callsSubject → BehaviorSubject<List<ChuckHttpCall>>
Reactive stream containing all intercepted HTTP calls Uses BehaviorSubject to maintain the latest state and allow new subscribers to receive the current value immediately
final
hashCode int
The hash code for this object.
no setterinherited
maxCallsCount int
Maximum number of HTTP calls to store in memory When this limit is reached, the oldest calls are removed using FIFO policy
final
getter/setter pair
notificationIcon String
Resource name for the notification icon (Android only)
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showInspectorOnShake bool
Whether to open the inspector when the device is shaken (physical devices only)
final
showNotification bool
Whether to show notifications when new HTTP requests are intercepted
final

Methods

addCall(ChuckHttpCall call) → void
Add Chuck http call to calls subject with optimized memory management
addError(ChuckHttpError error, int requestId) → void
Add error to existing Chuck http call with improved error handling
addHttpCall(ChuckHttpCall chuckHttpCall) → void
Add Chuck http call to calls subject
addResponse(ChuckHttpResponse response, int requestId) → void
Add response to existing Chuck http call with improved error handling
dispose() → void
Dispose subjects and subscriptions
getContext() BuildContext?
Get context from navigator key. Used to open inspector route.
Opens Http calls inspector. This will navigate user to the new fullscreen page where all listened http calls can be viewed.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeCalls() → void
Remove all calls from calls subject
saveHttpRequests(BuildContext context) → void
Save all calls to file
toString() String
A string representation of this object.
inherited

Operators

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