Skip to content

Latest commit

 

History

History
31 lines (17 loc) · 1.01 KB

File metadata and controls

31 lines (17 loc) · 1.01 KB

Storing API keys in a JSON file

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