0

My challenge is that I'm working on a public Flutter app and I don't want to expose my API keys in the source code. I'm specifically looking to inject the Google Maps API key into my AppDelegate.swift file.

Ideally I'd want to be able to pass this through with a .env file (and the then inject these keys as environment variables in CI/CD), but I'm also fine doing a --dart-define. I have not found any working example of how to get this working.

I'm able to get this working on the Android side of things without any issues.

Zach Russell
  • 1,060
  • 2
  • 13
  • 27

1 Answers1

0

You can save it as an plist dictionary, and add the reading code from the file. For example: https://stackoverflow.com/a/62916637/11798831 Also you could rename file by adding Bundle.main.path(forResource: "config", ofType: "env").object(...

You can do not commit it in the project, just keep it locally. Also add it as additional file in CI/CD.