async_storage_reader 1.0.0 async_storage_reader: ^1.0.0 copied to clipboard
Flutter package to read AsyncStorage data from React Native apps, aiding migration to Flutter without data loss.
Migrate Local Data from React Native to Flutter - async_storage_reader #
A Flutter package created to assist in migrating data from a React Native app by accessing and reading AsyncStorage for Android and iOS. It allows reading of AsyncStorage data from react native app, like user session tokens, preferences, other configurations, and cached data are preserved without logging out or data loss during migration to a new Flutter app.
Note: Please ensure that both the React Native and Flutter apps have the same bundle ID (for iOS) and application ID (for Android).
Why This Package? #
When migrating from React Native to Flutter, one of the most significant challenges is ensuring that existing data stored in the app is preserved. This could include user session tokens, settings, cached preferences, or any other key-value pairs that were previously stored using React Native's AsyncStorage. Without this, users might lose their preferences or be logged out. This package solves the problem by offering an easy way to access all AsyncStorage in your new Flutter app.
Demo Preview #
Platform Support for async_storage_reader #
The async_storage_reader
package provides support for both Android and iOS platforms.
Features #
- Read individual key-value pairs from React Native's AsyncStorage.
- Retrieve all key-value pairs stored in AsyncStorage.
- Support for both Android and iOS platforms.
- Prevent user logouts during app migrations by retrieving session tokens or other vital data.
- Provides methods to read, remove, and clear storage data.
Getting Started #
To use this package, add async_storage_reader
as a dependency in your pubspec.yaml
file:
dependencies:
async_storage_reader: ^1.0.0
Example Usage #
import 'package:async_storage_reader/async_storage_reader.dart';
final reader = AsyncStorageReader();
String? value = await reader.getItem('your_key');
print(value);
Map<String, String> allItems = await reader.getAllItems();
print(allItems);
bool success = await reader.removeItem('your_key');
print(success);
bool success = await reader.clear();
print(success);
License #
This project is licensed under the MIT License - see the LICENSE file for details.