> For the complete documentation index, see [llms.txt](https://sketchwaredocs.gitbook.io/home/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sketchwaredocs.gitbook.io/home/components/sharedpreference.md).

# SharedPreference

Shared Preference is used to locally save data on the device. (This page is cloned from the official docs)

## Basic Example

Using setData block to save a value of `Value` with the key `KeyName`.

![](https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-MG0ESfE5uK7_dWrVk3i%2F-MG0G5LV7EVLJaHVx878%2Fimage.png?alt=media\&token=28e32030-f46e-452b-81c8-99108ba5be70)

{% hint style="info" %}
You can think of the key as the file name, and the value as the contents of that file.
{% endhint %}

## Blocks

### getData

Retrieve the data saved at the specified key.

<div align="left"><img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-MG0MlHsTCHs_HWRcvm2%2F-MG0Mz19DQihAPHls6AN%2Fimage.png?alt=media&amp;token=04e9f062-f0f9-429f-8c05-2b9ea685c998" alt="getData"></div>

### setData

Save data to the specified key with a specified value.

<div align="left"><img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-MG0MlHsTCHs_HWRcvm2%2F-MG0NYETk0GMU-sTCOI_%2Fimage.png?alt=media&amp;token=90702563-80f3-4394-b37d-10e85fd4280f" alt="setData"></div>

### removeData

Remove the data at the specified key.

<div align="left"><img src="https://1589143646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M3AlXnP5kHENnvBXdKq%2F-MG0MlHsTCHs_HWRcvm2%2F-MG0NfWz3CYmMvhT596T%2Fimage.png?alt=media&amp;token=8443c032-b42e-4321-af0a-1ac678cc2a6e" alt="removeData"></div>
