Skip to content

Commit d61220c

Browse files
refactor(bloc): add isClosed to Closable (#3066)
1 parent 77bb1ce commit d61220c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/bloc/lib/src/bloc_base.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ abstract class Closable {
2121
/// Closes the current instance.
2222
/// The returned future completes when the instance has been closed.
2323
FutureOr<void> close();
24+
25+
/// Whether the object is closed.
26+
///
27+
/// An object is considered closed once [close] is called.
28+
bool get isClosed;
2429
}
2530

2631
/// An object that can emit new states.
@@ -72,6 +77,7 @@ abstract class BlocBase<State>
7277
///
7378
/// A bloc is considered closed once [close] is called.
7479
/// Subsequent state changes cannot occur within a closed bloc.
80+
@override
7581
bool get isClosed => _stateController.isClosed;
7682

7783
/// Updates the [state] to the provided [state].

0 commit comments

Comments
 (0)