Skip to content

Commit 966b015

Browse files
committed
Fixed whenStream extensions
1 parent 4f774dc commit 966b015

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

packages/wisecore/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.2.5
2+
3+
- Fixed the whenStream extension on `AsyncValue<T>`
4+
15
## 2.2.4
26

37
- [bugfix] LoadingStreamProvider > $StreamNotifier

packages/wisecore/lib/src/extensions/async_value_extensions.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import 'package:riverpod/riverpod.dart';
55
import '../utils/loading_stream_provider.dart';
66

77
/// Extensions for [AsyncValue] to simplify handling its states.
8-
extension AsyncValueExtensions<T> on AsyncValue<T> {
8+
extension AsyncStreamValueExtensions<T> on AsyncValue<T> {
99
/// Performs an action based on the state of the [AsyncValue]. mixed with
1010
/// [LoadingStreamProvider] to handle loading states correctly.
1111
///
@@ -71,6 +71,10 @@ extension AsyncValueExtensions<T> on AsyncValue<T> {
7171
return error(error, stackTrace!);
7272
}
7373

74+
if (requireValue == null) {
75+
return loading();
76+
}
77+
7478
return data(requireValue);
7579
},
7680
);

packages/wisecore/lib/src/extensions/extensions.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
export 'async_value_extensions.dart';
12
export 'color_extensions.dart';
23
export 'date_extensions.dart';
34
export 'double_extensions.dart';

packages/wisecore/pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: wisecore
22
description: A flutter core project used by Wisemen. Comes with a bunch of generally useful extensions and functions.
3-
version: 2.2.4
3+
version: 2.2.5
44
homepage: https://github.com/wisemen-digital/wisemen-flutter-packages/packages/wisecore
55
repository: https://github.com/wisemen-digital/wisemen-flutter-packages/packages/wisecore
66

@@ -27,8 +27,8 @@ dependencies:
2727
flutter_platform_alert: ^0.5.3
2828

2929
# platform interfaces
30-
plugin_platform_interface: any
31-
url_launcher_platform_interface: any
30+
plugin_platform_interface: ">=2.1.8 <3.0.0"
31+
url_launcher_platform_interface: ">=2.3.2 <3.0.0"
3232

3333
dev_dependencies:
3434
# Static analysis & linting

0 commit comments

Comments
 (0)