play_services_block_store 0.7.0
play_services_block_store: ^0.7.0 copied to clipboard
The Block Store API allows your app to store data that it can later retrieve to re-authenticate users on a new device.
play_services_block_store #
A Flutter plugin for accessing the Google Play Services Block Store API on Android. Securely store and retrieve small key-value pairs of data that can survive app uninstall and restore, making it ideal for authentication tokens or device identifiers.
⚠️ Android only. This plugin uses Google Play Services and is not supported on iOS or web.
Features #
- 🔐 Save and retrieve key-value pairs securely.
- 💾 Support for storing both strings and byte arrays.
- 🔍 Retrieve a single item.
- 🗑️ Delete individual keys or clear all stored data.
- 🧩 Easy-to-use Flutter API.
Getting Started #
Installation #
Add this to your pubspec.yaml
:
dependencies:
play_services_block_store: ^0.7.0
Then run:
flutter pub get
Usage #
import 'package:play_services_block_store/play_services_block_store.dart';
// Save a string
await PlayServicesBlockStore.saveString('username', 'alice');
// Retrieve a string
final username = await PlayServicesBlockStore.retrieveString('username');
// Save bytes
final byteData = Uint8List.fromList([1, 2, 3, 4]);
await PlayServicesBlockStore.saveBytes('my_bytes', byteData);
// Retrieve bytes
final byteData = await PlayServicesBlockStore.retrieveBytes('my_bytes');
// Delete a single key
await PlayServicesBlockStore.delete('username');
// Delete all stored data
await PlayServicesBlockStore.deleteAll();