initializeFromPersistor method

Future<void> initializeFromPersistor()

Implementation

Future<void> initializeFromPersistor() async {

  if(persistor != null){
    try{
      T? loadedState = await persistor!.load();

      if(loadedState != null){
        //Set state wil the new state
        dispatch(SetState(loadedState));

        //Runs any call backs on the persistor
        if(persistorCallBack != null){
          persistorCallBack!(this, loadedState);
        }
      }
    }catch(e){
      return;
    }

  }

}