搜索插件、代码仓与 APP 分类

插件详情v1.0.0

async_storage_reader

Flutter 包,用于从 React Native 应用读取 AsyncStorage 数据,帮助迁移至 Flutter 时避免数据丢失。

AndroidiOS
近 30 天下载
209
喜欢数
33
Pub 分数
150

安装插件

flutter pub add async_storage_reader

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个专为读取 React Native AsyncStorage 中存储数据而设计的 Flutter 包,可实现从 React Native 应用到 Flutter 的无缝数据迁移。它提供了一种简单的方法来访问序列化的键值对,无需更改现有的存储逻辑。在应用过渡期间,该包特别有用,因为保留用户数据至关重要。它支持 Android 和 iOS 平台,确保广泛的兼容性。通过利用原生文件系统访问,它能够安全地提取数据并保持完整性。

适合场景

  • 从 React Native 迁移到 Flutter
  • 在应用转换期间保留用户偏好
  • 读取旧版 AsyncStorage 文件
  • 支持混合应用开发阶段
  • 在框架之间实现数据可移植性

主要特点

  • 读取 AsyncStorage JSON 文件
  • 跨平台(Android 和 iOS)
  • 所需设置最少
  • 安全数据提取
  • 兼容 React Native 的存储格式

适合对象

  • 从 React Native 迁移到 Flutter 的开发者
  • 管理应用过渡的团队
  • 需要数据连续性的项目
  • 混合应用维护
  • 数据恢复场景

使用建议

  • 仅读取数据——不写入
  • 需要正确的文件路径访问
  • 不适用于实时同步
  • 限制为 AsyncStorage 格式
  • 不支持加密

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

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

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.

Connect With Me

GitHub: bilalrehman08 Linkedin: bilalrehman08 [YouTube: Bilal Rehman][youtube] Instagram: bilalrehman08 [Gmail: bilalrehman080808@gmail.com][gmail]

[gmail]: mailto:bilalrehman080808@gmail.com [youtube]: https://www.youtube.com/@bilalrehman08 [license]: https://github.com/BilalRehman08/Async-Storage-Reader/blob/main/LICENSE

所属分类

依赖

依赖清单 3 项

源码仓库

使用此插件的项目

暂无相关数据。