Skip to content

Commit 0a149ee

Browse files
authored
fix(offline_first): await closable streams #552 (#565)
1 parent cff7fdf commit 0a149ee

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

packages/brick_offline_first/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 4.0.1
2+
3+
- Fix never-completing Future on `#reset` (#552)
4+
15
## 4.0.0
26

37
- **BREAKING CHANGE** Require `brick_core: >= 2.0.0` and remove support for `Query(providerArgs:)`; see [migration steps](https://github.com/GetDutchie/brick/issues/510)

packages/brick_offline_first/lib/src/offline_first_repository.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,12 @@ abstract class OfflineFirstRepository<TRepositoryModel extends OfflineFirstModel
342342
memoryCacheProvider.reset();
343343
for (final subscription in subscriptions.values) {
344344
for (final controller in subscription.values) {
345-
await controller.close();
345+
// https://github.com/GetDutchie/brick/issues/552
346+
if (!controller.isClosed && controller.hasListener && !controller.isPaused) {
347+
await controller.close();
348+
} else {
349+
unawaited(controller.close());
350+
}
346351
}
347352
}
348353
subscriptions.clear();

packages/brick_offline_first/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ homepage: https://github.com/GetDutchie/brick/tree/main/packages/brick_offline_f
55
issue_tracker: https://github.com/GetDutchie/brick/issues
66
repository: https://github.com/GetDutchie/brick
77

8-
version: 4.0.0
8+
version: 4.0.1
99

1010
environment:
1111
sdk: ">=3.4.0 <4.0.0"

0 commit comments

Comments
 (0)