GitDoIt now uses flutter_dotenv for proper environment variable management.
The app loads environment variables in this order:
.env(in project root) - Your personal configuration.env.default(bundled with app) - Fallback with placeholder values
# Copy the default file
cp .env.default .env- Go to https://github.com/settings/developers
- Click "New OAuth App"
- Fill in:
Application name: GitDoIt Homepage URL: https://github.com/berlogabob/flutter-github-issues-todo Authorization callback URL: https://github.com/login/oauth/access_token - Click "Register application"
- Copy your Client ID (starts with
Iv1.)
Edit .env file:
nano .envReplace:
GITHUB_CLIENT_ID=your_client_id_here
With your actual Client ID:
GITHUB_CLIENT_ID=Iv1.xxxxxxxxxxxx
Save and exit (Ctrl+O, Enter, Ctrl+X).
flutter runThat's it! The app automatically loads .env on startup.
Project Root/
├── .env ← Your personal config (NOT committed to git)
├── .env.default ← Template with placeholders (committed to git)
└── lib/
└── main.dart ← Loads .env automatically
Loading Order:
- Try to load
.envfrom root directory - If not found, load
.env.default(bundled in assets) - OAuth service reads from
dotenv.env['GITHUB_CLIENT_ID']
The .env.default file is bundled with the app as a fallback.
For Release Builds:
You have two options:
# Copy your .env to build assets
cp .env build/flutter_assets/.env# Android
flutter build apk --dart-define=GITHUB_CLIENT_ID=Iv1.xxxxxxxxxxxx
# iOS
flutter build ios --dart-define=GITHUB_CLIENT_ID=Iv1.xxxxxxxxxxxx# GitHub OAuth Configuration
# This file is NOT committed to version control
GITHUB_CLIENT_ID=Iv1.xxxxxxxxxxxx# GitHub OAuth Configuration
# This is a TEMPLATE - replace with your actual values
GITHUB_CLIENT_ID=your_client_id_here# Environment variables - NEVER commit these
.envCheck if .env exists:
ls -la .envCheck if GITHUB_CLIENT_ID is set:
cat .env | grep GITHUB_CLIENT_IDShould show:
GITHUB_CLIENT_ID=Iv1.xxxxxxxxxxxx
If it shows your_client_id_here:
- Edit
.envand add your real Client ID - Restart the app
Check logs:
flutter run --verbose 2>&1 | grep "Loaded .env"Should show:
✅ Loaded .env from root directory
If it shows:
⚠️ .env not found in root, trying bundled default...
✅ Loaded .env.default (bundled)
This means your .env file is missing or in the wrong location.
- Keep
.envin your project root - Add your real Client ID
- Restart app after changes
- Use different Client IDs for dev/prod
- Commit
.envto version control - Share your Client ID publicly
- Use the same Client ID for multiple apps
- Hardcode Client ID in source code
Development:
- Create
.envwith your Client ID - Run
flutter run - App loads
.envautomatically
Production:
- Bundle
.envwith release build - Or use
--dart-defineat build time - App uses bundled config
That's the proper, production-ready way! ✅
For detailed OAuth setup instructions, see OAUTH_SETUP.md.