Future Then callback that returns null and a when-resolved not null Future generates an exception #48522
Labels
area-vm
Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
This only affects native dart (Flutter or the Dart CLI). dartpad does not generate this issue and executes correctly.
The above code when run generates this exception:
As I see it this should execute correctly, and indeed on the web (dartpad) it does.
Technically this is a
FutureOr<String?>?
I believe as this callback is notasync
and therefore is actually returning anull
value.However, if that's the case, why is the web version not generating this error?
Also, is the correct way to do something like this just make the callback
async
?dart --version
)Dart SDK version: 2.16.1 (stable) (Tue Feb 8 12:02:33 2022 +0100) on "macos_x64"
The text was updated successfully, but these errors were encountered: