Skip to content

Persistent cache library for Dart(Flutter for iOS and Android).

License

Notifications You must be signed in to change notification settings

ZuopanYao/plain_cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

plain_cache

Pub Package

Persistent cache library for Dart(Flutter for iOS and Android).

Installing

With Flutter:

flutter pub add plain_cache

This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get):

dependencies:
  plain_cache: ^1.0.3

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

Usage

Enable plain cache

import 'package:plain_cache/plain_cache.dart';

void main() {
  // Enable Plain Cache
  PlainCache.enable();

  runApp(MyApp());
}

simple usage example:

Save to persistent cache / 保存数据到持久性缓存

 storage.setValue('newValue', forKey: 'MyKey');

Read from persistent cache / 从持久性缓存中读取数据

final boolValue = storage.getBool(forKey: 'MyKey');
final doubleValue = storage.getDouble(forKey: 'MyKey');
final intValue = storage.getInt(forKey: 'MyKey');
final listValue = storage.getList(forKey: 'MyKey');
final mapValue = storage.getMap(forKey: 'MyKey');
final stringValue = storage.getString(forKey: 'MyKey');

Remove from persistent cache / 从持久性缓存中删除数据

storage.remove(forKey: 'MyKey');

License / 许可证

plain_cache is released under the MIT license. See LICENSE for details.

plain_cache 是在 MIT 许可下发布的,有关详情请查看该许可证。

About

Persistent cache library for Dart(Flutter for iOS and Android).

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages