Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix environment variable not found for authKey #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vishwamartur
Copy link

Related to #1

Update the environment variable for authKey and add documentation for setting up the .env file.

  • lib/env/env.dart

    • Update the @EnviedField annotation to use varName: 'AUTH_KEY' instead of varName: 'AUTH-KEY'.
  • .gitignore

    • Remove the .env entry from the ignore list.
  • .env

    • Add a new .env file with the content AUTH_KEY=your_auth_key_here.
  • README.md

    • Add a section to document the need for a .env file and the required AUTH_KEY variable.
    • Include instructions for running the project after setting up the .env file.

Related to code100x#1

Update the environment variable for `authKey` and add documentation for setting up the `.env` file.

* **lib/env/env.dart**
  - Update the `@EnviedField` annotation to use `varName: 'AUTH_KEY'` instead of `varName: 'AUTH-KEY'`.

* **.gitignore**
  - Remove the `.env` entry from the ignore list.

* **.env**
  - Add a new `.env` file with the content `AUTH_KEY=your_auth_key_here`.

* **README.md**
  - Add a section to document the need for a `.env` file and the required `AUTH_KEY` variable.
  - Include instructions for running the project after setting up the `.env` file.
@mrcodefrost
Copy link

Hi @vishwamartur , this is working thanks, i was able to generate the .env.g.dart but

  1. Where can i get the auth key ? @vishwamartur @harsimran-d

Note : In case same error is popping up after this change then refer to below solution

  1. Issue : Flutter was unable to detect the .env in root folder. ( root file is the one where your pubspec.yaml resides in hierarchy)
    Solution :
    I refactored it to secrets.env,
    ran the build_runner, it then ran successfully.
    Refactored it back to .env and deleted old g files and ran the build_runner again.

Worked perfectly this way

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants