restoreState static method

Future<void> restoreState(
  1. void callback(
    1. void update<T>(
      1. T t
      ),
    2. String modelName,
    3. String jsonStr
    ),
  2. List<String> serializerNames
)

Deserializes the previously serialized string into an object and makes it available in the WrenchStore

Implementation

static Future<void> restoreState(
  void Function(
    void Function<T>(T t) update,
    String modelName,
    String jsonStr,
  ) callback,
  List<String> serializerNames,
) async {
  if (persistent && hiveBox != null) {
    Box box = Hive.box(hiveBox!);
    if (box.isOpen) {
      for (dynamic key in box.keys) {
        if (serializerNames.contains(key)) {
          callback(WrenchStore.update, key, box.get(key));
        }
      }
    }
  }
}