Change `!= null` to `is T` to handle "double nullable" case
We use `dummyValueOrNull<T>`/`ifNotNull` combination to return a proper `Future<T>` when `T` is not known at compile time but a dummy value for `T` exists at run time, instead of falling back to creating a `FakeFuture` (that can't be `await`ed for example).
This works fine unless `T` itself allows `null` (is nullable or `void`). In this case `dummyValueOrNull<T>` returns `null`, but it's a proper `T`, not a failure. This CL changes `ifNotNull` to check `is T` instead of `!= null` to handle this properly.
PiperOrigin-RevId: 574437205
diff --git a/lib/src/dummies.dart b/lib/src/dummies.dart
index 71c77b6..7d85a62 100644
--- a/lib/src/dummies.dart
+++ b/lib/src/dummies.dart
@@ -174,4 +174,4 @@
// Helper function.
R? ifNotNull<T, R>(T? value, R Function(T) action) =>
- value != null ? action(value) : null;
+ value is T ? action(value) : null;