Skip to content

Commit

Permalink
4.22.0
Browse files Browse the repository at this point in the history
Took 21 minutes
  • Loading branch information
Drawner committed Jul 26, 2024
1 parent befa033 commit 475d036
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 22 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@

## 4.22.0
July 25, 2024
- /// Call the latest SateX object's error routine
/// Possibly the error occurred there.
bool onStateError(FlutterErrorDetails details) {
- /// Logs 'every' error as the error count is reset.
void logErrorDetails(FlutterErrorDetails details) {

## 4.21.0
July 22, 2024
- AppState.errorStateName - String getter naming last State class throwing an error
Expand Down
53 changes: 32 additions & 21 deletions lib/state_extended.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1418,7 +1418,8 @@ mixin StateXonErrorMixin {
/// Offer an error handler
void onError(FlutterErrorDetails details) {}

void _logError(FlutterErrorDetails details) {
/// Logs 'every' error as the error count is reset.
void logErrorDetails(FlutterErrorDetails details) {
// Don't when in DebugMode.
if (!kDebugMode) {
// Resets the count of errors to show a complete error message not an abbreviated one.
Expand Down Expand Up @@ -2733,7 +2734,7 @@ abstract class AppStateX<T extends StatefulWidget> extends StateX<T>
context: ErrorDescription('notifyClient() error in $this'),
);
// Record the error
_logError(details);
logErrorDetails(details);
}
}
}
Expand Down Expand Up @@ -2761,13 +2762,37 @@ abstract class AppStateX<T extends StatefulWidget> extends StateX<T>

// call the latest SateX object's error routine
// Possibly the error occurred there.
onStateError(details);

// Record to logs
logErrorDetails(details);

// Always test if there was an error in the error handler
// Include it in the error reporting as well.
if (hasError) {
_onErrorInHandler();
}

// Now out of the error handler
_inErrorRoutine = false;
}

/// A flag indicating we're running in the error routine.
/// Set to avoid infinite loop if in errors in the error routine.
bool _inErrorRoutine = false;

/// Call the latest SateX object's error routine
/// Possibly the error occurred there.
bool onStateError(FlutterErrorDetails details) {
//
final state = lastState;

if (state != null) {
bool caught = state != null;

if (caught) {
//
try {
//
bool caught = false;

final stack = details.stack?.toString();
//
if (stack != null) {
Expand Down Expand Up @@ -2800,23 +2825,9 @@ abstract class AppStateX<T extends StatefulWidget> extends StateX<T>
_onErrorInHandler();
}
}
// Record to logs
_logError(details);

// Always test if there was an error in the error handler
// Include it in the error reporting as well.
if (hasError) {
_onErrorInHandler();
}

// Now out of the error handler
_inErrorRoutine = false;
return caught;
}

/// A flag indicating we're running in the error routine.
/// Set to avoid infinite loop if in errors in the error routine.
bool _inErrorRoutine = false;

/// The name of the State object experiencing an error
String get errorStateName => _errorStateName ?? '';
String? _errorStateName;
Expand Down Expand Up @@ -2898,7 +2909,7 @@ abstract class AppStateX<T extends StatefulWidget> extends StateX<T>
);
try {
// Record the error
_logError(details);
logErrorDetails(details);
} catch (e, stack) {
// Error in the final error handler? That's a pickle.
recordException(e, stack);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: state_extended
description: This class extends the capabilities of Flutter's State class and includes a controller.
version: 4.21.0
version: 4.22.0
homepage: https://www.andrioussolutions.com
repository: https://github.com/AndriousSolutions/state_extended

Expand Down

0 comments on commit 475d036

Please sign in to comment.