Skip to content

Commit 92235d1

Browse files
committed
Fix typedValue not returning null when called on a null variable.
1 parent 65b708d commit 92235d1

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/src/api/typed_value.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ extension ObjectExt on Object? {
88
/// Returns [defaultValue] or null otherwise.
99
R? typedValue<R extends Object>({R? defaultValue}) {
1010
final value = this;
11+
if(this == null) return defaultValue;
1112
if (value is R) return value;
1213

1314
return switch (R) {

0 commit comments

Comments
 (0)