Failed to load asset at "assets/dotenv.develop" in flutter web - flutter

I am using .env file in flutter web.
Everything is OK when I run my project, locally on chrome and build apk.
But when I run my project in azure pipeline to deploy my flutter web, I get these errors:
GET https://***.net/assets/fonts/MaterialIcons-Regular.otf 404 (Not Found)
GET https://***.net/assets/.env.develop 404 (Not Found)
I tried running my project without .env file and everything was OK.
Also, I removed dot from the start of file name, from ".env" to "dotenv".
I added the file into the assets directory and include the file in the pubspec.yaml.
But didn't solve my issue.

Don't use .env as name for config file, use a name without "." Eg: dotenv
Here is the issue https://github.com/java-james/flutter_dotenv/issues/28

Related

Error: Importing variables from t3's .env file

I am trying to run Calc.com app. so I installed pgsql and then cloned calc.com And I run like this
yarn workspace #calcom/prisma db-deploy
than I got error
t first, I didn't have the .env file in any of my project folders, then I added it with the link to the database url, still not working.

Fiebase hosted url not working after deploying it again

I have update my already deployed flutter project and deployed it again in firebase . It shows the deployment is complete ,but my hosted url leads me to a firebase documentation page like below :
I intially typed:
firebase init
firebase deploy
The url was working fine when I deployed it for the first time . I
made some updation on my project and tried to deployed it again .What can I do now ?
this is my firebase.json:
I have solved the issue , I shouldn't have overwrite the index.html .Overwriting index.html will produce a default index.html which is created by firebase .So when they ask File build/web/index.html already exists. Overwrite? No should be given .
As I see your in image,it shows your build/web folder contains only 2 files in the folder. This is mostly happens if the deployment path incorrect.
Follow the steps to sovle the issue
Enter firebase init. After running this command it will show the parent folder path of your project as in the below image.
After that select Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys this future to host.
And then hit enter button
This will show you the public directory of your project as below
After that enter your public directory as build/web.
If you do all the above steps correctly while deploying the code, your build/web will contains around more than 70 files as the below image
I hope this will solve your issue

Unable to save file in VS code

I have Docker env setup and I have just installed some new files related to playwright testing and there is tests folder and other configurations files when I save I got following error in vs code:
And below is directory and I have another tests folder under frontend like: /tests/frontend/tests
How I can save these folder and files?

How can I use environment variables in flutter without adding a file in pubspec.yaml

At the moment I am using flutter_dotenv to load some environment variables from a file. It worked okay until I tried to create a GitHub Action that runs flutter test.
The file with the environment variables has to be added as an asset in pubspec.yaml acording to the documentation for the package so when I run the action I get the following error:
No file or variants found for asset: dotenv.
Where dotenv is the name of the file with environment variables. The reason I get the error is because dotenv is in .gitignore (obviously), so that file can't be found.
Is there a way to use environment variables in Flutter without having to add the file to pubspec.yaml? Or is it possible to add the file "locally" (meaning adding it to GitHub without having to track it with git) for the action in some way?

Why does the .env file get added to build/web/assets?

I'm using flutter_dotenv to manage some API keys - https://pub.dev/packages/flutter_dotenv
According to the instructions I should add the .env file to assets in pubspec.yaml but when I run flutter build web it adds the .env file to the build for deployment. This doesn't seem correct to me because the .env file should not get deployed anywhere publicly from what I understand.
I had the same issue, and solved it by renaming .env.* files to env.*.
https://pub.dev/packages/flutter_dotenv#usage
Note: If deploying to web server, ensure that the config file is uploaded and not ignored. (Whitelist the config file on the server, or name the config file without a leading .)