Skip to content

Commit

Permalink
fix: bad state error by always checking the bloc is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
mediocre9 committed Jul 21, 2024
1 parent f3cccab commit 8b4950b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/extensions.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import 'package:flutter_bloc/flutter_bloc.dart';

extension SafeEmitter<T> on Cubit<T> {
void safeEmit(T state) {
if (!isClosed) {
emit(state);
}
}
}

0 comments on commit 8b4950b

Please sign in to comment.