I am adjusting a private project to use BLoC. I like the strict separation in BLoC but I do not know how to adjust certain parts of my project.
One of those parts is a persistent login. In my old project, I achieved this using a singleton class and before the app starts, it checks contents in [flutter_secure_storage][1]
, which is loaded and checked by the server. I'm not familiar with "best practice" solutions. How would I achieve this neatly?
Another part is the 'database-connection'. My current project uses a simple interface to a REST API. This is used in combination with the authentication-singleton. I understand that the BLoC pattern requires a data layer, which should fetch data (in my case from the REST API). In my current situation, I simply get the auth data from the authentication-singleton. What is a better practice in this case?