Skip to content

Commit

Permalink
Merge pull request #6 from netglade/fix/tracking-id-nullability
Browse files Browse the repository at this point in the history
Fix nullability of tracking id
  • Loading branch information
petrnymsa authored Jul 19, 2024
2 parents 2bff688 + b46ffae commit 8d77544
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 1.2.1
- Fix nullability of trackingId in error handler

## 1.2.0
- Use `trackable` package
- UnexpectedError is now implementing GeneralTrackableError.
Expand Down
2 changes: 1 addition & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class CounterBloc extends SafeBloc<CounterEvent, CounterState> {
CounterState Function(UnexpectedError error) get errorState => CounterBlocError.new;

@override
Future<void> onUnexpectedError(Object? error, StackTrace stackTrace, String? trackingId) async {
Future<void> onUnexpectedError(Object? error, StackTrace stackTrace, String trackingId) async {
if (kDebugMode) {
print('Exception: $error, $stackTrace');
}
Expand Down
6 changes: 3 additions & 3 deletions lib/src/safe_bloc_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ abstract class SafeBlocBase<STATE, EFFECT> extends BlocBase<STATE>

/// A method that is called each time the exception in the inherited Bloc or Cubit is thrown.
@protected
Future<void> onUnexpectedError(Object? error, StackTrace stackTrace, String? trackingId) {
Future<void> onUnexpectedError(Object? error, StackTrace stackTrace, String trackingId) {
return Future.value();
}
}
Expand All @@ -34,9 +34,9 @@ typedef SyncCallback = void Function(String trackingId);

typedef OnIgnoreError = Future<void> Function(Object? error, StackTrace stackTrace);

typedef OnError = Future<void> Function(Object? error, StackTrace stackTrace, String? trackingId);
typedef OnError = Future<void> Function(Object? error, StackTrace stackTrace, String trackingId);

typedef OnErrorSync = void Function(Object? error, StackTrace stackTrace, String? trackingId);
typedef OnErrorSync = void Function(Object? error, StackTrace stackTrace, String trackingId);

typedef ErrorMapper<STATE> = STATE? Function(Object error);

Expand Down
2 changes: 1 addition & 1 deletion lib/src/safe_bloc_with_presentation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,5 @@ abstract class SafeBlocWithPresentation<EVENT, STATE, EFFECT> extends Bloc<EVENT
}

@override
Future<void> onUnexpectedError(Object? error, StackTrace stackTrace, String? trackingId) => Future.value();
Future<void> onUnexpectedError(Object? error, StackTrace stackTrace, String trackingId) => Future.value();
}
2 changes: 1 addition & 1 deletion lib/src/safe_cubit_with_presentation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ abstract class SafeCubitWithPresentation<STATE, EFFECT> extends Cubit<STATE>
);

@override
Future<void> onUnexpectedError(Object? error, StackTrace stackTrace, String? trackingId) => Future.value();
Future<void> onUnexpectedError(Object? error, StackTrace stackTrace, String trackingId) => Future.value();
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: safe_bloc
description: An extension to bloc state management library that manages unexpected exceptions.
version: 1.2.0
version: 1.2.1
repository: https://github.com/netglade/safe_bloc
issue_tracker: https://github.com/netglade/safe_bloc/issues
screenshots:
Expand Down

0 comments on commit 8d77544

Please sign in to comment.