shared_store

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

shared store

shared_store #
Native storage solution based on MMKV.
Example #
iOS







Android







Usage #
一,Flutter端 #
1.添加依赖:
dependencies:
flutter:
sdk: flutter

shared_store: ^0.01
copied to clipboard
2.启用SharedStore前,导入shared_store_plugin.dart对其进行初始化:
import 'package:shared_store/shared_store_plugin.dart';
copied to clipboard
SharedStorePlugin.initMMKV();
copied to clipboard
3.根据是否需要添加除内置默认的defaultMMKV外的可选的MMKV实例:
String customMMKVId = "testPlugin";
SharedStorePlugin.addMMKV(customMMKVId);
copied to clipboard
4.在需要存储数据时:
const bool testBool = true;
const int testInt = 123456;
const double testDouble = 3.1415926;
const String testString = 'testStringValue';
String? boolResult = await SharedStorePlugin.storeBool('testBool', testBool);
String? doubleResult = await SharedStorePlugin.storeDouble('testDouble', testDouble);
String? intResult = await SharedStorePlugin.storeInt('testInt', testInt);
String? stringResult = await SharedStorePlugin.storeString('testString', testString);
copied to clipboard
5.在需要读取数据时:
bool? readBool = await SharedStorePlugin.readBool('testBool');
int? readInt = await SharedStorePlugin.readInt('testInt');
double? readDouble = await SharedStorePlugin.readDouble('testDouble');
String? readString = await SharedStorePlugin.readString('testString');
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.

Related Products

More From This Creator