0

I want to Secure my API Key and I don't want to hardcode them in code like in image given below because anyone can decomplile app & get my secret key enter image description here

is there ant Better Way to do this

Abhishek Ghimire
  • 1,826
  • 2
  • 8
  • 11
  • Read this answser https://stackoverflow.com/questions/64527430/how-to-protect-flutter-app-from-reverse-engineering/64543495#64543495 very intersting – manic Feb 19 '22 at 13:46
  • You can check out this article [How to Store API Keys in Flutter: --dart-define vs .env files](https://codewithandrea.com/articles/flutter-api-keys-dart-define-env-files/) from Andrea – its-me-mahmud Feb 15 '23 at 11:30

2 Answers2

0

In order to not expose the API key client side, you need a backend solution. Firebase cloud functions work well with Flutter. You call your backend function which uses the newsapi and returns the results back to Flutter.

August Kimo
  • 1,503
  • 8
  • 17
0

you can use envied and use @EnviedField(obfuscate: true) to encrypt your keys