@@ -24,8 +24,8 @@ import 'package:flutter/material.dart';
2424///
2525/// // Using with error widget builder
2626/// Stac.initialize(
27- /// errorWidgetBuilder: (context, details ) {
28- /// return Text('Error in ${details .type}: ${details .error}');
27+ /// errorWidgetBuilder: (context, errorDetails ) {
28+ /// return Text('Error in ${errorDetails .type}: ${errorDetails .error}');
2929/// },
3030/// );
3131/// ```
@@ -96,31 +96,33 @@ class StacError {
9696/// A widget that displays detailed error information when Stac fails to parse JSON.
9797///
9898/// Shown when parsing fails, providing developers with context about what went wrong,
99- /// including the error type, message, JSON payload, and stack trace when available.
99+ /// including the error type, message, and JSON payload when available.
100100///
101101/// Features:
102- /// - Expandable error details with JSON and stack trace
103- /// - Context-aware troubleshooting tips
102+ /// - Expandable error details with JSON payload
103+ /// - Context-aware troubleshooting tips based on error type
104104/// - Copy-friendly selectable text for debugging
105105///
106+ /// Note: Stack traces are logged to the console but not displayed in the UI.
107+ /// Use a custom [StacErrorWidgetBuilder] if you need to display stack traces.
108+ ///
106109/// Example:
107110/// ```dart
108111/// StacErrorWidget(
109112/// error: StacError(
110113/// type: 'container',
111114/// error: FormatException('Invalid value'),
112115/// json: {'type': 'container', 'padding': 'invalid'},
113- /// stackTrace: StackTrace.current,
114116/// ),
115117/// )
116118/// ```
117119class StacErrorWidget extends StatefulWidget {
118120 const StacErrorWidget ({
119121 super .key,
120- required this .error ,
122+ required this .errorDetails ,
121123 });
122124
123- final StacError error ;
125+ final StacError errorDetails ;
124126
125127 @override
126128 State <StacErrorWidget > createState () => _StacErrorWidgetState ();
@@ -195,8 +197,8 @@ class _StacErrorWidgetState extends State<StacErrorWidget> {
195197 const SizedBox (height: 8 ),
196198
197199 // Type information (always visible, null-safe)
198- if (widget.error .type != null ) ...[
199- _buildInfoRow ('Type' , widget.error .type! ),
200+ if (widget.errorDetails .type != null ) ...[
201+ _buildInfoRow ('Type' , widget.errorDetails .type! ),
200202 const SizedBox (height: 4 ),
201203 ],
202204
@@ -215,7 +217,7 @@ class _StacErrorWidgetState extends State<StacErrorWidget> {
215217 const SizedBox (width: 8 ),
216218 Expanded (
217219 child: Text (
218- widget.error .error.toString (),
220+ widget.errorDetails .error.toString (),
219221 style: const TextStyle (
220222 color: _errorRed,
221223 fontSize: 13 ,
@@ -233,12 +235,12 @@ class _StacErrorWidgetState extends State<StacErrorWidget> {
233235 const SizedBox (height: 8 ),
234236
235237 // JSON data
236- if (widget.error .json != null ) ...[
238+ if (widget.errorDetails .json != null ) ...[
237239 _buildExpandableSection (
238240 title: 'JSON Data' ,
239241 section: _ExpandableSection .json,
240242 child: _buildCodeBlock (
241- _formatJson (widget.error .json! ),
243+ _formatJson (widget.errorDetails .json! ),
242244 ),
243245 ),
244246 const SizedBox (height: 8 ),
@@ -398,8 +400,9 @@ class _StacErrorWidgetState extends State<StacErrorWidget> {
398400 }
399401
400402 String _getTroubleshootingTips () {
401- final errorStr = widget.error.error.toString ().toLowerCase ();
402- final errorType = widget.error.error.runtimeType.toString ().toLowerCase ();
403+ final errorStr = widget.errorDetails.error.toString ().toLowerCase ();
404+ final errorType =
405+ widget.errorDetails.error.runtimeType.toString ().toLowerCase ();
403406
404407 // Check for unregistered widget/action types
405408 if (errorStr.contains ('type' ) && errorStr.contains ('not found' )) {
0 commit comments