flutter code display error in visual studio code - flutter

Initially this code is correct but after I reinstalled Windows and its applications, the project that was correct is now an error.
My project error
flutter doctor -v :
[√] Flutter (Channel dev, 1.26.0-1.0.pre, on Microsoft Windows [Version 10.0.19042.804], locale en-US)
• Flutter version 1.26.0-1.0.pre at F:\src\flutter
• Framework revision 63062a6443 (9 weeks ago), 2020-12-13 23:19:13 +0800
• Engine revision 4797b06652
• Dart version 2.12.0 (build 2.12.0-141.0.dev)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at F:\src\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.
[√] 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)
[√] VS Code (version 1.53.2)
• VS Code at C:\Users\hyda\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.19.0
[√] Connected device (1 available)
• sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
• No issues found!

The error you get is because the libraries are not loaded. First, go to the pubseck.yaml file and get the packages there. If still not working see this command
-> flutter clean
-> flutter pub get

Such problems can be solved by running this command:
flutter clean
Once that is done, go to pubspec.yaml and check if all the packages are still there. For cross-checking, run:
flutter pub get
This will solve your problem.

Related

I got Flutter Build time and runtime error - Execution failed for task ':background_locator:compileDebugKotlin'

I got Flutter Build time and runtime error - Execution failed for task ':background_locator:compileDebugKotlin'.
when i try to run the app i got error as below, please help me.
Please can anyone help me to how i solve this problem.
below is my flutter doctor -v output.
PS D:__> flutter doctor -v
[√] Flutter (Channel stable, 3.0.1, on Microsoft Windows [Version 10.0.19044.1706], locale en-IN)
• Flutter version 3.0.1 at D:\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision fb57da5f94 (8 days ago), 2022-05-19 15:50:29 -0700
• Engine revision caaafc5604
• Dart version 2.17.1
• DevTools version 2.12.2
Checking Android licenses is taking an unexpectedly long time...[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at C:\Users\Dev_Flutter\AppData\Local\Android\sdk
• Platform android-32, build-tools 31.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• 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 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 2020.3)
• 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.10+0-b96-7249189)
[√] VS Code (version 1.67.2)
• VS Code at C:\Users\Dev_Flutter\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.40.0
[√] Connected device (4 available)
• CPH2127 (mobile) • 1cb8d2b1 • android-arm64 • Android 11 (API 30)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19044.1706]
• Chrome (web) • chrome • web-javascript • Google Chrome 101.0.4951.67
• Edge (web) • edge • web-javascript • Microsoft Edge 101.0.1210.39
[√] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
Try This command in your project directory:
Flutter Pub Upgrade
There may be an inconsistency between your imported package and the flutter version you're using. this command will upgrade your packages to the latest feasible version.
Also, Please Provide your Flutter doctor output which is helpful to find a solution.

Flutter Material icons: some icons dont exist in the flutter's Icons class

I realize that this is a duplicate of this question, but that question does not seem to have any activity so I'm trying to get more attention to this issue.
I am trying to use the percent icon from Material icons, although in the fonts.google.com site,it shows flutter implementation (screenshot attached below), when I try to call it from flutter code I get the error The getter 'percent' isn't defined for the type 'Icons'. (screenshot attached below).
what is the reason for this, and why is google trying to show some icon is supported for flutter when it clearly is not?
here is my flutter doctor -v output:
[√] Flutter (Channel stable, 2.8.0, on Microsoft Windows [Version 10.0.19041.1348], locale en-US)
• Flutter version 2.8.0 at C:\Users\adnan\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision cf44000065 (23 hours ago), 2021-12-08 14:06:50 -0800
• Engine revision 40a99c5951
• Dart version 2.15.0
• Pub download mirror https://pub.flutter-io.cn
• Flutter download mirror https://storage.flutter-io.cn
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\adnan\AppData\Local\Android\sdk
• Platform android-31, build-tools 30.0.3
• Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 2020.3)
• Android Studio at C:\Program Files\Android\Android Studio1
• 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.10+0-b96-7249189)
[!] Android Studio (version 4.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
X Unable to determine bundled Java version.
• Try updating or re-installing Android Studio.
[√] VS Code (version 1.62.3)
• VS Code at C:\Users\adnan\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.29.0
[√] VS Code (version 1.61.0-insider)
• VS Code at C:\Users\adnan\AppData\Local\Programs\Microsoft VS Code Insiders
• Flutter extension can be installed from:
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (3 available)
• sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 96.0.4664.45
• Edge (web) • edge • web-javascript • Microsoft Edge 96.0.1054.43
! Doctor found issues in 1 category.
Apparently, now with Flutter 2.10, they've added some icons.
Last but not least, we’ve added 1,028 new Material icons.
which kinda answers this question, so the clear answer is whenever we encounter such an issue, we have to just sit and wait for flutter to integrate those icons, or use another Icons package.

Android studio got stuck at creating flutter project

After upgrading my flutter, when i try to create a new flutter project it get stuck showing creating flutter project for hours without any change And when i run flutter doctor -v, i have no issues.
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at C:\Users\USER\Documents\Sdk
• Platform android-30, build-tools 30.0.2
• ANDROID_HOME = C:\Users\USER\Documents\Sdk
• 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
[√] Android Studio (version 4.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 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.60.0)
• VS Code at C:\Users\USER\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.23.0
[√] Connected device (1 available)
• Chrome (web) • chrome • web-javascript • Google Chrome 92.0.4515.107
• No issues found!
Try these following(one by one):
Reinstall Flutter plugin.
Reinstall flutter SDK.

Upgrading camera_platform_interface from 1.0.4 to 1.2.0 results in camera not working

There's no error logs printed, so it's difficult to provide some more information about what is causing this. With the same code base, same camera plugin version (0.6.3+2), if I run flutter pub upgrade and camera_platform_interface bumps from 1.0.4 to 1.2.0, parts of our app that use the camera stop working (black screen).
[√] Flutter (Channel stable, 1.22.5, on Microsoft Windows [Versión 10.0.19042.685], locale es-ES)
• Flutter version 1.22.5 at C:\src\flutter
• Framework revision 7891006299 (3 weeks ago), 2020-12-10 11:54:40 -0800
• Engine revision ae90085a84
• Dart version 2.10.4
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\crist\AppData\Local\Android\Sdk
• Platform android-30, build-tools 30.0.3
• ANDROID_HOME = C:\Users\crist\AppData\Local\Android\Sdk
• 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.
[!] Android Studio (version 4.1.0)
• Android Studio at C:\Program Files\Android\Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] Connected device (1 available)
• ONEPLUS A5000 (mobile) • f2eb43ee • android-arm64 • Android 10 (API 29)
! Doctor found issues in 1 category.
You can use a dependency override to workaround the problem.
Adding the following to your pubspec.yaml should solve the issue:
dependency_overrides:
camera_platform_interface: ">=1.0.4 <1.1.0"

Flutter on-screen keyboard not showing characters

As of recently I started receiving a broken on-screen keyboard when running (or debugging) my Flutter app.
See the attached screenshot from running a form validation demo from https://flutter.dev/docs/cookbook/forms/validation.
The keyboard actually accepts keypresses. Wierd thing is that switching to uppercase makes the keyboard show the (uppercase) characters. Should I uninstall/install the stack again or are some other measures appropriate?
PS C:\Users\Pavel\testform> flutter doctor -v
[√] Flutter (Channel stable, 1.20.3, on Microsoft Windows [Version 10.0.18362.1016], locale et-EE)
• Flutter version 1.20.3 at c:\flutter
• Framework revision 216dee60c0 (8 days ago), 2020-09-01 12:24:47 -0700
• Engine revision d1bc06f032
• Dart version 2.9.2
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at C:\Users\Pavel\AppData\Local\Android\sdk
• Platform android-29, build-tools 29.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.
[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 47.1.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.48.2)
• VS Code at C:\Users\Pavel\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.14.1
[√] Connected device (1 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• No issues found!
Go to android studio -> avd manager -> your emulator -> wipe data and try again. If not resolved, delete the emulator and create a new one.
Try to cold-boot the emulator. This works for me!