Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
PfeiJit committed Sep 12, 2023
1 parent 14168eb commit c4242b5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ class CounterBloc extends SafeBloc<CounterEvent, CounterState> {
onSafe<IncrementPressed>(_increment, isAction: true);
}

FutureOr<void> _increment(IncrementPressed event, SafeEmitter<CounterState> emit, {required String trackingId}) async {
if (state case final CounterLoaded loaded) {
FutureOr<void> _increment(IncrementPressed event, SafeEmitter<CounterState> emit,
{required String trackingId}) async {
if (state case final CounterLoaded loaded) {
final incrementedCount = loaded.count + 1;

final preferences = await SharedPreferences.getInstance();
Expand Down Expand Up @@ -125,5 +126,4 @@ class CounterBloc extends SafeBloc<CounterEvent, CounterState> {
print('Exception: $error, $stackTrace');
}
}

}
3 changes: 2 additions & 1 deletion lib/src/safe_bloc_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import 'package:safe_bloc/src/unexpected_error.dart';

export 'package:bloc/bloc.dart' show Emitter;

abstract class SafeBlocBase<STATE> extends BlocBase<STATE> with SafeBlocBaseMixin<STATE>, BlocPresentationMixin<STATE, BaseEffect> {
abstract class SafeBlocBase<STATE> extends BlocBase<STATE>
with SafeBlocBaseMixin<STATE>, BlocPresentationMixin<STATE, BaseEffect> {
SafeBlocBase(super._state);

/// A method that is called each time the exception in the inherited Bloc or Cubit is thrown.
Expand Down
1 change: 0 additions & 1 deletion lib/src/safe_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ abstract class SafeCubit<STATE> extends Cubit<STATE>
implements SafeBlocBase<STATE> {
SafeCubit(super.initialState);


/// Wraps a cubit callback in try-catch block and processes them based on specified parameters.
/// - [devErrorMessage] - A string message that is passes to UnexpectedError object in emitted event or state.
/// - [isAction] - If set to true, the passed `callback` is a user action (e.g button pressing). If set to false(default), the `callback` is a initial data loading.
Expand Down

0 comments on commit c4242b5

Please sign in to comment.