Whenever we have to use shared preferences we have to create an instance of it.
In flutter creating an instance of shared preference is asynchronous;
final prefs = await SharedPreferences.getInstance();
we have to create its instance always whenever we have to use it like above.
Is there a way to create a single instance of shared preferences which will be available to the overall project and we don't have to create its instance again and again in Flutter?
To create Singleton class of
SharedPreference:Put this class in project
Initialize this class in initState() main class
Access in methods
more: https://dev.to/lucianojung/flutter-singelton-pattern-1a38