store static method

Future store(
  1. String key,
  2. dynamic object
)

Saves an object to local storage.

Implementation

static Future store(String key, object) async {
  assert(object != null);

  if (object is String) {
    return await StorageManager.storage.write(key: key, value: object);
  }

  if (object is int) {
    return await StorageManager.storage
        .write(key: key, value: object.toString());
  }

  if (object is double) {
    return await StorageManager.storage
        .write(key: key, value: object.toString());
  }

  if (object is Storable) {
    return await StorageManager.storage
        .write(key: key, value: jsonEncode(object.toStorage()));
  }
}