---
title: xray_shared_preferences_inspector
description: >-
  Key-value inspector for SharedPreferences. Browse, edit, add and delete
  preferences with their types from the xRay desktop app.
---
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xrayinspector.dev/llms.txt
> Use this file to discover all available pages before exploring further.

[![pub package](https://img.shields.io/pub/v/xray_shared_preferences_inspector.svg)](https://pub.dev/packages/xray_shared_preferences_inspector)

Shows your app's `SharedPreferences` in the **Key-Value** tab of the xRay desktop app, where you can browse, edit, add and delete them while the app runs.

## Installation

```yaml
dependencies:
  xray_inspector: ^0.1.0
  xray_shared_preferences_inspector: ^0.1.0
  shared_preferences: ^2.2.0
```

## Usage

```dart
import 'package:shared_preferences/shared_preferences.dart';
import 'package:xray_shared_preferences_inspector/xray_shared_preferences_inspector.dart';

final prefs = await SharedPreferences.getInstance();
final inspector = XRaySharedPreferencesInspector(prefs: prefs);
```

Then pass it to `XRayInspectorServerConfig`. See [Quick Start](/getting-started) for the full server setup.

## Capabilities

- **Read**: lists every key with its value and type (`String`, `bool`, `int`, `double` or `List<String>`).
- **Edit**: writes the new value back with the type the key already has, so your app keeps reading it with the same getter. A value that does not fit that type is refused with a message.
- **Add**: creates a key with any of these types.
- **Delete**: removes a key.
- **Refresh**: re-reads all values on demand.

## Notes

- String lists are shown and edited as JSON arrays.
- The inspector's title is `"Shared Preferences"`, shown in the desktop app.
