Flutter: I have changed the Dart entrypoint to Login.dart , while building apks error shows that lib\main.dart not found - flutter

C:\flutter\flutter_windows_v1.9.1+hotfix.2-stable\flutter\bin\flutter.bat --no-color build apk
Target file "lib\main.dart" not found.
Process finished with exit code 1

You can set an entry point like this:
flutter run --target=lib/Login.dart
flutter build apk --target=lib/Login.dart
This article shows you how to set up IDE (VSCode/AS) to build another target file.

I don't think you should be changing the entry file, you can always use the main.dart without issues and then set the Entry class there. This doesn't stop your app from working.

Related

Target file "lib\main.dart" not found. flutter

Even I have the file in lib/ folder flutter gives me error
Here is my file
C:\SRC\flutter\packages\flutter_tools>flutter run
Target file "lib\main.dart" not found.
Edit:
here is my configuration
I have looked to this topic
Getting error like "Target file "lib\main.dart" not found." whlie building APK in flutter
But this situation is different from mine.
Reason:
This is the error because of the main execution starts searching main file, but can't find it.
Solution:
Go to Edit Configurations...
Set here main.dart file as dart entry point here and save it...
Another Solution
Run following command
flutter run -t lib/main.dart

I have issue when creating my first flutter app

After creating my app on flutter, I tried to create an app file from it ..
But I keep getting an error which says "flutter.bat failed to run. System cannot find the path specified at line1 char1"
I don't know if there's a solution to that.enter image description here
run flutter doctor -v and discard what it produces.
And try to fix your project, for this call
flutter create project_name for the folder where the root project is located.

No pubspec.yaml file found. in flutter

I tried to build the project from vs code terminal but it just threw an error
According to the image, there is another folder inside of flutter-quizstar-master-step, therefore execute:
cd flutter-quizstar-master
then
flutter build apk

Flutter Web crashes with Cannot open file client.js

May I ask your help about this error
It's happen when I'm trying for the first time running my flutter web which using flutter run -d chrome
Launching lib\main.dart on Chrome in debug mode...
Syncing files to device Chrome...
25,220ms (!)
GET /dwds/src/injected/client.js
Error thrown by handler.
FileSystemException: Cannot open file, path = 'C:\Users\Acer\flutter\.pub-cache\hosted\pub.dartlang.org\dwds-2.0.1\lib\src\injected\client.js' (OS Error: The system cannot find the path specified.
, errno = 3)
dart:isolate _RawReceivePortImpl._handleMessage
And if I trying run using
flutter run -d web
It's doesn't thrown any error but on the website it goes blank white nothing shown up.
Anyway thanks for your help
adding the following in the pubspec.yaml worked for me. I am using beta channel.
dependencies:
dwds: ^16.0.1
then run command:
flutter update-packages
I was also facing the same issue, I don't know the exact root cause of the problem but I have a hack to make it work.
I was facing the issue after I deleted .pub-cache folder, so from my recycler bin I picked dwds-2.0.1 folder and reverted back. This hack working
add dwds package in your dependencies and run flutter update-packages. It will work :)

new flutter project in vscode has error

when i create a new flutter project in vscode it will immediately shows an error in the main.dart file and gives a gradle error when trying to debug.
shown here: main.dart error
"compiler message: lib/main.dart:68:19: Error: Too few positional arguments: 1 required, 0 given."
I've reinstalled dart and flutter plugins. updated the java install.
in debug console i get this:
debug console
added output of flutter doctor -v
enter image description here
I was also facing the same error, but it was always on my test folder.
This is what I did:
On your terminal, make sure you are in your project repository.
Run the flutter pub get command, it worked for me, may be you
should try it too.
Do you possibly have two different versions of the Flutter SDK on your machine? I wonder if one is being used by flutter create and the other for analysis.
If you're sure you only have one, please open an issue on GitHub and attach a log file for me to investigate.