save method

Future save(
  1. String key, {
  2. bool inBackpack = false,
})

Save the object to secure storage using a unique key. E.g. User class

User user = new User(); user.name = "Anthony"; user.save('com.company.app.auth_user');

Get user User user = await NyStorage.read

Implementation

Future save(String key, {bool inBackpack = false}) async {
  await NyStorage.store(key, this);
  if (inBackpack) {
    Backpack.instance.set(key, this);
  }
}