How to pass secrets to Flutter web hosted by Cloudflare pages?
I have a flutter web which need to access supabase using the access key. How can I pass this key to the flutter web? My research shows two solutions:
- use base64 (https://stackoverflow.com/questions/67964110/how-to-access-secrets-when-using-flutter-web-with-github-actions). This solution may not apply to my use case as I am not using github action to build my flutter web. Instead, I use peanut (https://hrishikeshpathak.com/blog/flutter-web-hosting-cloudflare/). Plus, base64 is not secure. I am not sure if the js compiled from flutter can still expose the secrets after building with secrets whether plain text or decoded from base64 encoding.
- use page functions which seems to be more secure. However, I did not find doc for using page functions in flutter web app.
- which way is the recommended?
- if 2, could you share any pointers how to use page functions in flutter web? Thanks very much!
Stack Overflow
I have a flutter web app and for accessing the database I have hardcoded an APIKey in a secrets.dart file, And this works perfectly fine. I have added this file to .gitignore in order to prevent it...