undefined name 'widget' in stateful widget flutter - flutter

Suddenly i started facing this error in my all project. Even I tried to create new project but failed too.
I am using stateful widget and when I try to access class variable using widget then i face this error.
Flutter doctor output:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.22.2, on Mac OS X 10.15.6 19G2021, locale en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 11.7)
[✓] Android Studio (version 3.4)
[✓] VS Code (version 1.50.1)
[✓] Connected device (1 available)
I tried flutter clean but no luck.

Related

Flutter launcher icons fails because --sound-null-safety missing

I am trying to create icons for my app using flutter_launcher_icons, with options defined in pubspec.yaml. When I run flutter pub run flutter_launcher_icons:main, I get the following error:
Unable to spawn isolate: error: Library 'file:///Users/cameron/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_launcher_icons-0.9.0/bin/main.dart' was compiled with sound null safety (in strong mode) and it requires --sound-null-safety option at runtime
pub finished with exit code 1
Even if I pass in --sound-null-safety, the error persists (I also tried '--no-sound-null-safety' which also did nothing).
To check it wasn't a configuration error, I ran flutter create <name>, added flutter_launcher_icons: to dev dependencies (and flutter pub get), ran the same command and got the same error.
I am on Flutter 2.2, and I depend on integration_test, so I can't downgrade to a pre-null-safety version of flutter_launcher_icons, because those versions have transitive dependencies that conflict with integration_test from sdk.
Flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.2.2, on macOS 11.4 20F71 darwin-x64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2020.3.4)
[✓] VS Code (version 1.57.1)
[✓] Connected device (2 available)
• No issues found!

Flutter app not compiling after upgrading

output of flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.2.2, on Linux, locale en_GB.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.56.2)
[✓] Connected device (2 available)
• No issues found!
After i did dart pub upgrade ...i got the following..
output of --stacktrace
I was getting the same error and I tried
flutter clean
and then
dart pub upgrade
for the Dependencies upgrade.
and then it started working you can just click on the Pub Upgrade in Android studio in pubspec.yml file of your projects.
Or you can remove the dependency which is creating issue after upgarde.

Failed to launch DevTools: TimeoutException after 0:00:10.000000: Future not completed

The flutter tools aren't launching when I press the button on Android Studio, and I also get a warning when I use flutter run.
I've tried flutter clean, but this still happens on both the terminal and Android Studio flutter plugin.
flutter doctor output:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.2, on macOS 11.2.3 20D91 darwin-x64, locale
en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] Android Studio
[✓] VS Code (version 1.54.3)
[✓] Connected device (2 available)
• No issues found!
Does anyone have suggestions on how to fix this?
Rebooting my computer fixed it.

Could not open android app with release with Flutter beta 1.25.0-8.1.pre

I've recently updated Flutter to 1.25.0-8.1.pre in beta. I could run debug apk and build release. But, the release-apk doesn't work and it stuck on default splash screen. Where the problem lies in. Is there any such bug from Flutter?
flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, 1.25.0-8.1.pre, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Chrome - develop for the web
[✓] Android Studio
[✓] IntelliJ IDEA Community Edition (version 2020.3)
[✓] VS Code (version 1.52.1)
[✓] Connected device (3 available)
• No issues found!
I just downgrade the flutter version to 1.24.0-10.2.pre which released on 11/19/2020 and retried building release apk. And it worked fine. Actually the problem lies with Flutter new update on beta. The corresponding issue : https://github.com/flutter/flutter/issues/72705

Error Creating new Flutter App with AndrodX

I'm trying to create a Flutter app with Android-X
following this this INFORMATION,
the date is quite recent,
so I'm assuming they are up to date.
The problem is when I run on flutter console
flutter create -a kotlin -i swift --androidx my-app-name
I get this error:
Could not find an option named "androidx".
(running: flutter create blablabla everything works fine)
[edit: this is my flutter doctor]
Doctor summary (to see all details, run flutter doctor -v): [√]
Flutter (Channel stable, v1.5.4-hotfix.2, on Microsoft Windows
[Version 10.0.17763.557], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK
version 28.0.3) [√] Android Studio (version 3.3) [√] VS Code (version
1.35.1) [√] Connected device (1 available)
• No issues found!
Did I miss something?