Thunder class
A debug overlay widget that displays network logs and provides debugging tools.
The Thunder widget creates a slide-out panel that shows network requests and responses from provided Dio instances. This is particularly useful during development to monitor API interactions, debug network issues, and analyze app behavior.
Features:
- Displays network requests and responses from Dio instances
- Provides filtering and search capabilities for logs
- Allows clearing of logs
- Can be easily toggled with a handle on the side of the screen
- Only active in debug mode by default
- enabled: Whether to enable the overlay (defaults to kDebugMode)
- dio: List of Dio instances to monitor for network activity
- duration: Animation duration for showing/hiding the overlay
- child: The main application widget that Thunder will wrap
Example:
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) => MaterialApp(
title: 'Flutter Demo',
home: const MyHomePage(title: 'Flutter Demo Home Page'),
builder: (context, child) => Thunder(
dio: [_httpDio, _mainDio],
child: child ?? SizedBox.shrink(),
),
);
}
You can also use Thunder without initializing the widget by directly adding the interceptor to a Dio instance:
// This will work even before a Thunder widget is created
final dio = Dio()..interceptors.add(Thunder.getInterceptor);
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- Thunder
Constructors
Properties
- child → Widget
-
The child widget (the main widget of the app).
final
- color → Color?
-
The color of the Thunder.
final
-
dio
→ List<
Dio> -
The list of
Dio
instances to monitor.final - duration → Duration
-
The duration of the overlay animation.
final
- enabled → bool
-
Whether to enable the overlay.
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
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< Thunder> -
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
Static Properties
- getDiosHash → String
-
Utility to see the dio instances that are being monitored.
no setter
Static Methods
-
addDio(
Dio dio) → Dio - Adds a Dio instance to be tracked by Thunder