'Error importing files in vsCode flutter/dart files
my app was running before I decided to plug my phone to test it on a real device.
I'm working on MacOS and I used to work with iPhone 13 simulator . I plugged my Galaxy phone and started the debug.
This is my flutter doctor :
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.2, on macOS 12.2.1 21D62 darwin-arm, locale en-TN)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.1)
[✓] VS Code (version 1.66.2)
[✓] Connected device (2 available)
[✓] HTTP Host Availability
• No issues found!
As I said , I plugged my phone then weird error keeps coming out of no where !
: Error: The method 'ProductDetail' isn't defined for the class '_PopularProductsState'.
package:FreedomDistribution/…/components/popular_product.dart:58
- '_PopularProductsState' is from 'package:FreedomDistribution/screens/home//components/popular_product.dart' ('lib/screens/home//components/popular_product.dart').
package:FreedomDistribution/…/components/popular_product.dart:1
Try correcting the name to the name of an existing method, or defining a method named 'ProductDetail'.
builder: (context) => ProductDetail(
^^^^^^^^^^^^^
I got almost 200 errors like this , and my imports are just fine (tested like 5min ago , nothing changed) ..
I tried , flutter clean , closing vsCode , unplug phone .. nothing !
I found in some thread that I should delete .vscode but I didn't find it (show hidden files are checked).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
