Did you know?
Since Flutter 3.7, you can store all your API keys inside a JSON file and pass it to a new --dart-define-from-file
flag from the command line.
(you'll want to add that JSON file to .gitignore to avoid exposing your sensitive keys)
Then in your Dart code, simply use String.fromEnvironment
to retrieve your keys and use them as needed. 👇
To learn about different techniques and best practices for storing API keys in Flutter, check out my (updated) article: 👇
Found this useful? Show some love and share the original tweet 🙏
Previous | Next |
---|---|
Backend-agnostic Flutter apps | Firebase Auth flow in 5 minutes |