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?