reactive_forms
reactive_forms copied to clipboard
The control is NOT implicitly set to 'double' data type in Web platform.
Environment
Flutter Web Package version: 17.0.1
Flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.24.0, on Microsoft Windows [Version 10.0.19045.4780], locale pl-PL)
[√] 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 2022 17.10.4)
[√] Android Studio (version 2024.1)
[√] IntelliJ IDEA Community Edition (version 2020.3)
[√] VS Code, 64-bit edition (version 1.92.2)
[√] Connected device (3 available)
[√] Network resources
• No issues found!
Code sample
In MaterialViewModel class:
final FormGroup form = fb.group({
'ilosc': [0.0],
}, []);
...
In MaterialView class:
ReactiveTextField<double>(
formControlName: 'ilosc',
),
Description
The control is NOT implicitly set to 'double' data type in Web platform.
Expected behavior: The control should be implicitly set to 'double' data type.
Current behavior: Exception:
══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════ The following BindingCastException<double, String> was thrown building ReactiveFormPopScope: BindingCastException: The widget ReactiveTextField
bound to "ilosc" control is expecting a "FormControl " data type, but received a "FormControl " data type. This is caused because the template data type declared in the widget "ReactiveTextField<double>" is not a 'subtype' of the template data type declared in the control "FormControl<int>".