storageInitializer static method

Future<void> storageInitializer(
  1. IPersistStore store
)

Initialize the default persistence provider to be used.

Called in the main method:

void main()async{
WidgetsFlutterBinding.ensureInitialized();

await RM.storageInitializer(IPersistStoreImp());
runApp(MyApp());
}

This is considered as the default storage provider. It can be overridden with PersistState.persistStateProvider

For test use RM.storageInitializerMock.

Implementation

static Future<void> storageInitializer(IPersistStore store) async {
  if (_persistStateGlobal != null || _persistStateGlobalTest != null) {
    return;
  }
  _persistStateGlobal = store;
  return _persistStateGlobal?.init();
}