put method

void put({
  1. required String key,
  2. dynamic data,
})

保存数据 key 存储key data dynamic data

Implementation

void put({required String key, dynamic data}) {
  if (data is int) {
    putInt(key: key, value: data);
  } else if (data is double) {
    putDouble(key: key, value: data);
  } else if (data is bool) {
    putBool(key: key, value: data);
  } else if (data is String) {
    putString(key: key, value: data);
  } else {
    if (key.isNotEmptyString) {
      var content = JsonUtils.toJson(data);
      _storageData<String>(key, content, "string");
    }
  }
}