{"id":22393506,"url":"https://github.com/nialixus/env_reader","last_synced_at":"2025-04-13T05:46:27.878Z","repository":{"id":190605436,"uuid":"682991008","full_name":"Nialixus/env_reader","owner":"Nialixus","description":"Read, encrypt, or generate environment variables from a .env file into an obfuscated Dart model.","archived":false,"fork":false,"pushed_at":"2023-12-09T11:27:42.000Z","size":365,"stargazers_count":3,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-13T05:46:09.104Z","etag":null,"topics":["dart","dotenv","env","environment","flutter"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Nialixus.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":"nialixus","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2023-08-25T10:39:08.000Z","updated_at":"2024-11-03T13:29:41.000Z","dependencies_parsed_at":"2024-01-09T18:17:27.208Z","dependency_job_id":null,"html_url":"https://github.com/Nialixus/env_reader","commit_stats":{"total_commits":45,"total_committers":2,"mean_commits":22.5,"dds":0.3111111111111111,"last_synced_commit":"0fe285ce06451804da94303a9028ebdc3f341ed0"},"previous_names":["nialixus/env_reader"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nialixus%2Fenv_reader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nialixus%2Fenv_reader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nialixus%2Fenv_reader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nialixus%2Fenv_reader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nialixus","download_url":"https://codeload.github.com/Nialixus/env_reader/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248670512,"owners_count":21142901,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dart","dotenv","env","environment","flutter"],"created_at":"2024-12-05T05:05:52.523Z","updated_at":"2025-04-13T05:46:27.857Z","avatar_url":"https://github.com/Nialixus.png","language":"Dart","funding_links":["https://ko-fi.com/nialixus"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src='https://user-images.githubusercontent.com/45191605/274121951-21239cc4-37b3-4dd2-864f-d5f528da4e22.png' width=200 height=200/\u003e\n  \u003cbr\u003e\n  \u003ca href='https://pub.dev/packages/env_reader'\u003e\u003cimg src='https://img.shields.io/pub/v/env_reader.svg?logo=flutter\u0026color=blue\u0026style=flat-square'/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n# Env Reader\nRead, encrypt, or generate environment variables from .env file into an obfuscated Dart model.\n\n## Features 🚀\n- **Automated Generation:** Transform your .env files into dynamic Dart models directly. No need to add annotation. ✨\n- **Seamless Integration:** Directly update your pubspec.yaml and .gitignore on command. No need manual labor. 🛠️ \n- **Fortified Encryption:** Shield your precious .env configurations with an encryption. Say no to prying eyes.🔒  \n- **Data Diversity Unleashed:** Whether they're integers, decimals, booleans, or strings. Automatic interpretation is at your service. 🎮\n- **Versatile Sourcing**: Load your .env from various sources: assets, files, memory, network, and strings. The choice is yours. 🔄\n\n## Install 🚀\nGet started with these quick commands:\n\n🔥 Add `env_reader` to your `pubspec.yaml` with a single line: \n```bash\ndart pub add env_reader\n```\n  \n✨ Unlock the magic by activating the `env_reader` CLI:\n```bash\ndart pub global activate env_reader\n```\n\n## Usage 🚀\nNow elevate your development experience with these straightforward steps:\n\n### 1. Set up your configuration\nStart by crafting your `.env` file in the root directory of your project, right alongside your trusty `pubspec.yaml`.\n```env\nAPI_KEY=VYIUJ7tLdJFqrBesnOJEpkbceBB5GNz0t1aYgHxK3BMxbJOc/g==\nDEBUG=true\nPORT=8080\nDATABASE_URL=postgresql://user:password@localhost:5432/mydb\n```\n---\n\n### 2. Run the command (Optional)\nNow, if you want to generate encrypted env file, run this command in your terminal:\n```bash\nenv_reader --input=\".env\" --output=\"assets/env/\" --key=\"MyOptionalSecretKey\"\n```\n\u003e [!NOTE]\n\u003e **`output:`** .env successfully encrypted into assets/env/.env 🚀\n\nalso if you want to generate dart model from this env file, use tihs:\n```bash\nenv_reader --input-\".env\" --model=\"lib/src/env_model.dart\" --null-safety\n```\n\u003e [!NOTE]\n\u003e **`output:`** .env successfully generated into lib/src/env_model.dart 🎉\n---\n\n### 3. Loading your .env\nLoad the env_reader instance:\n```dart\nimport 'package:env_reader/env_reader.dart';\nimport 'package:flutter/services.dart';\n\nawait Env.load(\n  EnvStringLoader(await rootBundle.loadString('assets/env/.env')),\n  \"MyOptionalSecretKey\");\n\n// Or you can load by creating your own `EnvReader` instance.\n\nEnvReader production = EnvReader();\nawait production.load(\n  EnvStringLoader(await rootBundle.loadString('assets/env/.env')),\n  \"MyOptionalSecretKey\");\n```\n---\n\n### 4. Access your configuration\nTo get and read the value of your env:\n```dart\nimport 'package:env_reader/env_reader.dart';\nimport 'package:my_package/src/env_model.dart';\n\nString api = Env.read(\"API_KEY\") ?? \"Got'cha 😎\";\nbool debug = Env.read\u003cbool\u003e(\"DEBUG\") ?? false;\n\n// If you make your own instance, call it like this\n\nString api = production.read(\"API_KEY\") ?? \"Got'cha 😎\";\nbool debug = production.read\u003cbool\u003e(\"DEBUG\") ?? false;\n\nText(\n  text:\n    debug ? \"🤫 pssst, this is my api key y'all \\n\\n $api\" : \"Nothing to see here 🤪\",\n);\n\n// Or you can access the value directly from env generated model earlier\n\nText(\n  text:\n    EnvModel.debug ? \"🤫 pssst, this is my api key y'all \\n\\n ${EnvModel.apiKey}\" : \"Nothing to see here 🤪\",\n);\n```\n---\n\n## Env Reader Command 🚀\nAvailable commands:\n\n| Flag                     | Description                                                  |\n|--------------------------|--------------------------------------------------------------|\n| -i, --input (mandatory)  | Input path of the .env file                                  |\n| -o, --output             | Output path for the encrypted .env file                      |\n| -s, --key                | Secrey key for encryption \u0026 decryption                       |\n| --model                  | Generate dart model file to your desired file path           |\n| --null-safety            | Make the model null safety                                   |\n| --[no-]obfuscate         | Obfuscating generated values of model                        |\n|                          | (defaults to on)                                             |\n| --[no-]pubspec           | Insert asset path to pubspec.yaml                            |\n|                          | (defaults to on)                                             |\n| --[no-]gitignore         | Insert .env input \u0026 output file into .gitignore              |\n|                          | (defaults to on)                                             |\n| -h, --help               | Print usage information                                      |\n\nExample usage:\n```bash\nenv_reader -i \".env\" -o \"assets/env/\" -s \"MyOptionalSecretKey\" --model=\"lib/src/env_model.dart\" --null-safety\n```\n\n\n## Example 🚀\n\n- \u003ca href=\"https://github.com/Nialixus/env_reader/blob/main/example/lib/main.dart\"\u003eenv_reader/example/lib/main.dart\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnialixus%2Fenv_reader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnialixus%2Fenv_reader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnialixus%2Fenv_reader/lists"}