Problem with AltGr key in flutter Windows desktop - flutter

In any Flutter app in a TextField widget, on Windows, pressing once the AltGr key will drive Windows keyboard crazy: after pressing AltGr, Windows behaves as if the ctrl key was pressed continuously in any application. (Pressing a simple v behaves like if the ctrl-v was pressed) Just double-pressing the left ctrl key will stop this strange state.
Thus, no Windows application written in flutter can be published because if the user presses the AltGr key, he will not understand why his keyboard will not work in any other application afterwards.
It can be reproduced every time, in every environment. On other Windows too. On other machine too. In release exe version too. E.g. in StaleFulWidget, and a TextField in it.
Could somebody help me to solve this very serious Flutter bug? Thank you in advance.
Windows version: Win 10 Pro 20H2 (build:19042.870) Hungarian version. In Hungarian keyboard the # key is AltGr+v. So users can not type any email address.
Flutter versions:
Flutter is already up to date on channel beta
Flutter 2.1.0-12.2.pre • channel beta • https://github.com/flutter/flutter.git
Framework • revision 5bedb7b1d5 (6 days ago) • 2021-03-17 17:06:30 -0700
Engine • revision 711ab3fda0
Tools • Dart 2.13.0 (build 2.13.0-116.0.dev)
Flutter doctor is perfect.
C:\flutter\bin\flutter.bat doctor --verbose
[√] Flutter (Channel beta, 2.1.0-12.2.pre, on Microsoft Windows [Version 10.0.19042.870], locale hu-HU)
• Flutter version 2.1.0-12.2.pre at C:\flutter
• Framework revision 5bedb7b1d5 (6 days ago), 2021-03-17 17:06:30 -0700
• Engine revision 711ab3fda0
• Dart version 2.13.0 (build 2.13.0-116.0.dev)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\zsmik\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.9.2)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.9.31112.23
• Windows 10 SDK version 10.0.18362.0
[√] Android Studio (version 4.1.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19042.870]
• Chrome (web) • chrome • web-javascript • Google Chrome 89.0.4389.90
• Edge (web) • edge • web-javascript • Microsoft Edge 89.0.774.57
• No issues found!

As of December 6 2021, this is fixed on the master channel.
If you don't want other projects to be affected, you can use https://pub.dev/packages/fvm to use that channel on a per-project level:
activate the tool, running dart pub global activate fvm in your project directory
run fvm use master
run your app using fvm flutter run, or specify the flutter SDK symlinked in your project folder within the ".fvm" directory for your IDE to use for compiling the app.

Related

**flutter_blue_plus** This version of %1 is not compatible with the version of >Windows you're running. What should I do?

So this project of mine had flutter_blue plugin in it. And I just switched to flutter_blue_plus. And now I can't run it on my system. And this is the error it shows. And when I checked, it feels like no one else is facing this issue. There's no mention on the flutter_blue_plus package issue list either. And i found some of the similar kind of problems on stackOverflow from years ago. And it seems like they're just android problems. And I'm not an android developer. Another known flutter developer faced the same issue with the original flutter_blue package on M1 pro. And on his device, flutter_blue_plus runs properly. I'm using Windows 11 for my development.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':flutter_blue_plus:generateDebugProto'.
java.io.IOException: Cannot run program "E:\Dev\Gradle\caches\modules-2\files->2.1\com.google.protobuf\protoc\3.18.0\61d7f5d8849eb1c9b86ff07ca3f6172ce904ed4\protoc-3.18.0-osx->x86_64.exe": CreateProcess error=216, This version of %1 is not compatible with the version of >Windows you're running. Check your computer's system information and then contact the software >publisher
I've tried the basic steps, like cleaning and rebuilding project. And here is the device speceficaiton im using.
flutter doctor -v.
[√] Flutter (Channel stable, 3.7.0, on Microsoft Windows [Version 10.0.22623.1245], locale en-US)
• Flutter version 3.7.0 on channel stable at C:\SDK_FILES\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision b06b8b2710 (6 days ago), 2023-01-23 16:55:55 -0800
• Engine revision b24591ed32
• Dart version 2.19.0
• DevTools version 2.20.1
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
• Android SDK at C:\SDK_FILES\Android_Studio_Components
• Platform android-33, build-tools 33.0.1
• ANDROID_HOME = C:\SDK_FILES\Android_Studio_Components
• Java binary at: C:\SDK_FILES\Android\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.3.3)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.3.32825.248
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2022.1)
• Android Studio at C:\SDK_FILES\Android
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
[√] VS Code (version 1.74.3)
• VS Code at C:\Users\User\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.58.0
[√] Connected device (4 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22623.1245]
• Chrome (web) • chrome • web-javascript • Google Chrome 109.0.5414.120
• Edge (web) • edge • web-javascript • Microsoft Edge 109.0.1518.61
[√] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
If someone is facing this problem. Or anything that looks familiar to it. You can try checking your gradle.properties file inside your projects android folder. And if there's any line that looks like this
protoc_platform=osx-x86_64
Try removing it.
To my little bit of understanding it's just saying the gradle system to look for the macOs operating system while creating the protoc buffer. And it's not finding it bcz the platform is windows. At least in my case, it was. It can be vice versa.

Flutter Windows Application fails to compile

I want to debug the flutter demo application on windows x64 device.but it always fails with 1 error and 1 warning this is my Debug console :
Launching lib\main.dart on Windows in debug mode...
lib\main.dart:1
F:\flut\flutter_application_5\windows\runner\utils.cpp(52,43): error C2220: warning treated as error - no 'object' file generated [F:\flut\flutter_application_5\build\windows\runner\flutter_application_5.vcxproj]
F:\flut\flutter_application_5\windows\runner\utils.cpp(52,43): warning C4018: '>': signed/unsigned mismatch [F:\flut\flutter_application_5\build\windows\runner\flutter_application_5.vcxproj]
Exception: Build process failed.
and here is my flutter doctor log :
[flutter] flutter doctor -v
[√] Flutter (Channel stable, 3.0.5, on Microsoft Windows [Version 10.0.19044.1826], locale en-US)
• Flutter version 3.0.5 at C:\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f1875d570e (6 weeks ago), 2022-07-13 11:24:16 -0700
• Engine revision e85ea0e79c
• Dart version 2.17.6
• DevTools version 2.12.2
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at C:\Users\MEMPHIS\AppData\Local\Android\sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Enterprise 2019 16.1.0)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise
• Visual Studio Enterprise 2019 version 16.1.28917.181
• Windows 10 SDK version 10.0.17763.0
[√] Android Studio (version 2021.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
[√] VS Code (version 1.70.2)
• VS Code at C:\Users\MEMPHIS\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.46.0
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19044.1826]
• Chrome (web) • chrome • web-javascript • Google Chrome 104.0.5112.102
• Edge (web) • edge • web-javascript • Microsoft Edge 104.0.1293.63
[√] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
exit code 0
I can debug the demo app on edge, chrome, android without any problem
so What wrong?
The (Microsoft) C++ compiler is raising a warning inside the utils.cpp file:
windows\runner\utils.cpp(52,43): warning C4018: '>': signed/unsigned mismatch
It's configured to treat warnings as errors, so the compile fails with:
windows\runner\utils.cpp(52,43): error C2220: warning treated as error - no 'object' file generated
I don't believe that /WX (warnings as errors) can be configured other than by the build script (which turns it ON).
I suspect one of two things:
The Enterprise edition of the compiler (which you have) is slightly more picky than the Community edition (which I have). You could edit the project file to turn off warnings-as-errors, or add an exception for this warning (more below).
Your compiler needs upgrading. I've got 16.11.something; you've got 16.1.something. Run the Visual Studio Installer again to upgrade it. (For example: I just ran it, and it's suggesting I upgrade from 16.11.10 to 16.11.18...).
Editing the project file
The winapp.vcxproj project file is (apparently) generated by CMake. Edit windows\CMakeLists.txt and change the following line:
target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
Make it look like this:
target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100" /wd4018)
I don't know where the quotes come from; you might need them. Alternatively, remove the /WX bit.

throw PlatformException error when trying to use Google Authentication

I am trying to use google authentication to log in to my app. Previously, I had this code running perfectly on my other laptop, but now that I have moved the same code and setup to another machine I am facing issues.
I have added SHA1 and SHA256 keys into my firebase, added the google-services.json file in my app folder. Currently, when I click my button to sign in with google, it shows me my account and let's me click it. However, upon clicking, it automatically redirects me to the messages_codecs.dart file and highlights this line throw PlatformException(code: errorCode, message: errorMessage as String?, details: errorDetails, stacktrace: errorStacktrace);
I was initially facing this identical error upon clicking on my sign in button, but then realized I was not using a AVM with google play store enabled. After changing that, it brings me through the sign in process, but after gives the same error.
You can find my whole file structure here. It is inside this question - StreamBuilder issue - snapshot.connectionState == ConnectionState.waiting when a TextFormField widget is clicked.,
I have searched and tried every solution online but nothing seems to work
Here is my flutter doctor -v
[√] Flutter (Channel master, 3.1.0-0.0.pre.966, on Microsoft Windows [Version 10.0.22000.613], locale en-US)
• Flutter version 3.1.0-0.0.pre.966 at C:\Users\aryan\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision df52b510ca (18 hours ago), 2022-05-27 06:13:06 -0400
• Engine revision 436f18b5a2
• Dart version 2.18.0 (build 2.18.0-149.0.dev)
• DevTools version 2.13.1
[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
• Android SDK at C:\Users\aryan\AppData\Local\Android\sdk
• Platform android-32, build-tools 32.1.0-rc1
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[!] Visual Studio - develop for Windows (Visual Studio Community 2019 16.7.5)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.7.30523.141
• Windows 10 SDK version 10.0.18362.0
X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development with C++" workload, and include these components:
MSVC v142 - VS 2019 C++ x64/x86 build tools
- If there are multiple build tool versions available, install the latest
C++ CMake tools for Windows
Windows 10 SDK
[√] Android Studio (version 2021.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
[√] VS Code (version 1.67.2)
• VS Code at C:\Users\aryan\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.40.0
[√] Connected device (4 available)
• sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22000.613]
• Chrome (web) • chrome • web-javascript • Google Chrome 102.0.5005.61
• Edge (web) • edge • web-javascript • Microsoft Edge 101.0.1210.53
[√] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 1 category.

How do I get hot Reload to work with flutter?

I have tried just about everything. Uninstalled the flutter plug in, made sure my path was right. Ran flutter doctor and everything is fine. Ran flutter clean up.
Even tried switching to windows beta.
Can't do a hot Reload when I run in windows app but I can do it when I run it for chrome.
Using Android Studio bumblebee which I have also reinstalled.
Any other advice?
Added my flutter doctor -v
[√] Flutter (Channel beta, 2.11.0-0.1.pre, on Microsoft Windows [Version 10.0.19042.1526], locale en-US)
• Flutter version 2.11.0-0.1.pre at C:\Users\pluca\Documents\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision b101bfe32f (7 days ago), 2022-02-16 07:36:54 -0800
• Engine revision e355993572
• Dart version 2.17.0 (build 2.17.0-69.2.beta)
• DevTools version 2.10.0-dev.1
[√] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
• Android SDK at C:\Users\pluca\AppData\Local\Android\sdk
• Platform android-32, build-tools 32.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.0)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.1.32210.238
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2021.1)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19042.1526]
• Chrome (web) • chrome • web-javascript • Google Chrome 98.0.4758.102
• Edge (web) • edge • web-javascript • Microsoft Edge 98.0.1108.56
[√] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
I figured it out! I was running Visual Studio 2022. I uninstalled it an installed Visual Studio 2019.
Now it works!!!

VsCode Dart code highlighting wrong colors

I have a very strange issue. After upgrading Flutter yesterday to the newest version, my syntax highlighting is awfully off. When I open a file, everything seems fine, but as soon as the file is analyzed and the result is used for highlighting, everything breaks.
Correct (for 1-2 seconds after opening the file):
Wrong (after around 2 seconds):
I am using the Monokai Theme for VsCode. I would love to get my old coloring back, as I think the new scheme is outrageously difficult to look at.
My Flutter Doctor outpu (All versions etc.):
[flutter] flutter doctor -v
[√] Flutter (Channel stable, 2.0.3, on Microsoft Windows [Version 10.0.19042.867], locale en-NZ)
• Flutter version 2.0.3 at R:\Programme\Flutter
• Framework revision 4d7946a68d (3 days ago), 2021-03-18 17:24:33 -0700
• Engine revision 3459eb2436
• Dart version 2.12.2
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at R:\Programme\Android\sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: R:\Programme\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 4.0)
• Android Studio at R:\Programme\Android\Android Studio
• Flutter plugin version 48.1.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] IntelliJ IDEA Ultimate Edition (version 2020.3)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2019.2.2
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
[√] VS Code, 64-bit edition (version 1.54.3)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.20.0
[√] Connected device (2 available)
• Chrome (web) • chrome • web-javascript • Google Chrome 89.0.4389.90
• Edge (web) • edge • web-javascript • Microsoft Edge 89.0.774.57
• No issues found!
exit code 0
Any help would be greatly appreciated :)
Add "editor.semanticHighlighting.enabled": false in your vscode settings.json