Skip to content

Commit 39ceb42

Browse files
Work around mock stores having a null didDispose
1 parent afaac26 commit 39ceb42

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/src/over_react_redux/over_react_flux.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ class ConnectFluxAdapterStore<S extends flux.Store> extends redux.Store<S> {
138138
// In most cases, though, from a memory management standpoint, tearing this
139139
// store down shouldn't be necessary, since any components subscribed to it
140140
// should have also been unmounted, leaving nothing to retain it.
141-
store.didDispose.whenComplete(teardown);
141+
//
142+
// Use a null-aware to accommodate mock stores in unit tests that return null for `didDispose`.
143+
store.didDispose?.whenComplete(teardown);
142144
}
143145

144146
bool _teardownCalled = false;

0 commit comments

Comments
 (0)