It has a large flutter system that has worked normally for years, I recently updated flutter to version 3.19.5 and since then I have had several problems only in the web version in profile and release mode, which do not happen anywhere else.
Everyone was able to adapt, but this last one caught my attention, apparently Flutter, when converting the code to js, is assuming that a variable is always null, below are some images:
In the lines A.print("copyWith(): nameForUser.runtimeType: " + A.S(cavalo) + " = " + B.JSNull_methods.get$runtimeType(cavalo).toString$0(0) + " = true"); when print the value calls the function "A.S()" but when print the type calls the function "B.JSNull_methods"
On the line t1 = id == null ? _this.id : id; it checks if the id is different from null, already on the line t2 = _this.nameForUser; it disregards the parameter passed in the function
That the code does not automatically consider the variable null
Actual results
When converting to javascript, dart is assuming the variable as always null
Flutter Doctor output
[√] Flutter (Channel stable, 3.19.5, on Microsoft Windows [versÆo 10.0.22631.3447], locale pt-BR)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2019 16.11.32)
[!] Android Studio (version 2021.2)
X Unable to determine bundled Java version.
[√] Android Studio (version 2023.2)
[√] VS Code (version 1.88.1)
[√] Connected device (3 available)
[√] Network resources
Steps to reproduce
It has a large flutter system that has worked normally for years, I recently updated flutter to version 3.19.5 and since then I have had several problems only in the web version in profile and release mode, which do not happen anywhere else.
Everyone was able to adapt, but this last one caught my attention, apparently Flutter, when converting the code to js, is assuming that a variable is always null, below are some images:
Below is the generated javascript code:
In the lines
A.print("copyWith(): nameForUser.runtimeType: " + A.S(cavalo) + " = " + B.JSNull_methods.get$runtimeType(cavalo).toString$0(0) + " = true");
when print the value calls the function "A.S()" but when print the type calls the function "B.JSNull_methods"On the line
t1 = id == null ? _this.id : id;
it checks if the id is different from null, already on the linet2 = _this.nameForUser;
it disregards the parameter passed in the functionI've already tried changing the name and position of the variable but nothing works. I found two similar problems: https://github.com/dart-lang/sdk/issues/44692 https://github.com/dart-lang/sdk/issues/44692
Expected results
That the code does not automatically consider the variable null
Actual results
When converting to javascript, dart is assuming the variable as always null
Flutter Doctor output
[√] Flutter (Channel stable, 3.19.5, on Microsoft Windows [versÆo 10.0.22631.3447], locale pt-BR) [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Android toolchain - develop for Android devices (Android SDK version 33.0.0) [√] Chrome - develop for the web [√] Visual Studio - develop Windows apps (Visual Studio Community 2019 16.11.32) [!] Android Studio (version 2021.2) X Unable to determine bundled Java version. [√] Android Studio (version 2023.2) [√] VS Code (version 1.88.1) [√] Connected device (3 available) [√] Network resources