put static method

Future<bool> put(
  1. String key,
  2. dynamic value
)

value只支持int、double、bool、String基础数据 自定义对象数据请使用putWithJson

Implementation

static Future<bool> put(String key, dynamic value) async {
  if (value != null) {
    var runtimeType = value.runtimeType.toString();
    if ("int" != runtimeType &&
        "double" != runtimeType &&
        "bool" != runtimeType &&
        "String" != runtimeType) {
      throw Exception("Value必须是基础的int、double、bool或String");
    }
  }

  if (_storage != null) {
    await _storage!.put(key, value);
    return true;
  }
  return false;
}