01
02
🚨The Danger is Real
Hardcoded API keys = exposed secrets.
🔓 Anyone can decompile your APK or AAB.
👨💻 Hackers can easily access Firebase,
APIs, or encryption secrets.
03
📂Use .env Files
Store secrets like API tokens, keys, or IDs in
.env files.
❌ Never hardcode them directly into your
Flutter code.
📁 Keep .env files outside of your assets/ or
build/ folder.
04
🎯Separate
Environments
Use different .env files for each environment:
staging.env for staging builds
production.env for live builds
🔐 Keeps production keys isolated and
safer.
05
🧠Native Dart
Support
No plugins needed! Access keys like this:
Simple, clean, and native to Flutter.
06
🧪Debugging Setup
(launch.json)
Configure your launch settings
✅ Ensures env keys are available while
debugging.
07
🛠️Build with Secrets
Safely
Building for production?
🚫Don’t Do This
08
Building for production?
Never:
Put .env in assets/ or build/
Upload .env to GitHub
Your secrets will leak and expose your app!
🔐Pro Tip — Unique
Keys
Generate unique API keys per environment.
Don't reuse production keys in dev or staging.
Limits exposure and improves traceability.
💬Join the
09
Conversation
Are you using .env in your Flutter apps?
FOLLOW ME
FOR MORE
Waleed Ashraf
Software Engieer
@waleed-ashrf