syncToBackpack static method

Future syncToBackpack({
  1. bool overwrite = false,
})

Sync all the keys stored to the Backpack instance.

Implementation

static Future syncToBackpack({bool overwrite = false}) async {
  Map<String, String> values = await readAll();
  Backpack backpack = Backpack.instance;
  for (var data in values.entries) {
    if (overwrite == false && backpack.contains(data.key)) {
      continue;
    }
    dynamic result = await NyStorage.read(data.key);
    Backpack.instance.save(data.key, result);
  }
}