Closed UnnikrishnanBhargavakurup closed 5 years ago
Hi @UnnikrishnanBhargavakurup 👋
Check out this tutorial for how to read/write files. In addition, you might want to consider not going this route and instead, injecting your keys/secrets at build time so that they aren't hard-coded in your source code.
I'm trying BLoC pattern in flutter, I created a repository and API client to access remote REST API in the repository.
I created an instance of the client and the repository in my main function and i'm passing the client as an argument to the repository.
Here my problem is my API client requires some credentials to access the remote server and I'm thinking it should read the credentials from a JSON file. How I can do that?
Also I'm confused from where I should read the JSON file, in the main function or in the API client Also where should I place the JSON file?
Thanks, Unnikrishnan B.