ShakeForChucker class


🧩 ShakeForChucker

A developer utility widget that allows opening the Chucker network inspector by shaking the device a configurable number of times.

This is designed to improve developer productivity and QA testing by enabling quick access to Chucker without code changes or manual buttons.

🚀 Features:

  • Automatically detects shake gestures using the shake package.
  • Opens the Chucker UI after a configurable number of shakes within a short period (default: 3 shakes within 2 seconds).
  • Automatically disabled in release mode (unless explicitly enabled).
  • Optional bottom notification when Chucker is active via isShowBottomNotif.

💡 Example:

void main() {
  runApp(
    const ShakeForChucker(
      isChuckerActive: true,      // Enable even in non-debug builds
      shakeCountTriggered: 2,      // Show Chucker after 2 shakes
      isShowBottomNotif: true,     // Show notification when Chucker is active
      child: MyApp(),
    ),
  );
}

⚠️ Important setup: To fully integrate Chucker, make sure to add its navigatorObserver to your MaterialApp:

MaterialApp(
  navigatorObservers: [
    ChuckerFlutter.navigatorObserver,
  ],
  ...
)

This allows Chucker to properly track navigation events and display network logs contextually.

🧱 Dependencies:

  • chucker_flutter — for in-app network inspection.
  • shake — for detecting phone shake gestures.

Inheritance

Constructors

ShakeForChucker({Key? key, required Widget child, int shakeCountTriggered = 3, bool forceHideChucker = false})
const

Properties

child Widget
The widget subtree wrapped by this widget.
final
forceHideChucker bool
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shakeCountTriggered int
The number of shakes required to trigger Chucker. Defaults to 3 shakes within 2 seconds.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<ShakeForChucker>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

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