init static method
Initializes the instance of the SharedPreferences
. Should be execute on
the startup of the app, mainly on the main method.
Can receive a GlobalKey right on the init to handle navigation
Implementation
static Future<void> init({GlobalKey<NavigatorState>? key}) async {
if (key != null) {
navigatorKey = key;
}
sharedPreferences = await SharedPreferences.getInstance();
}