---
name: "getStorageSync"
mode: "kit"
versionRequirements:
  - { name: "BaseKit", version: "2.0.1" }
platform:
  - "iOS"
  - "Android"
---

## getStorageSync

> [VERSION] BaseKit >= 2.0.1

> [PLATFORM] iOS, Android

### Description

Asynchronously get the content for the specified key from local storage

### Parameters

`Params`

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `storageKeyBean` | `StorageKeyBean` | No | - | Parameter object |

### Referenced Types

##### `interface` StorageKeyBean

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `key` | `string` | `2.0.1` | Specified key in local storage |


### Examples

```tsx
// Read the value of the specified key from local storage: write first, then read to demonstrate a full round trip
ty.setStorage({
  key: "demoKey",
  data: "demoValue",
  success: () => {
    ty.getStorage({
      key: "demoKey",
      success: data => console.log("Read content:", data),
      fail: error => console.error(error),
    });
  },
  fail: error => console.error(error),
});
```
