safe_local_storage 2.0.1 copy "safe_local_storage: ^2.0.1" to clipboard
safe_local_storage: ^2.0.1 copied to clipboard

A safe caching library to read/write values on local storage.

example/main.dart

import 'dart:io';

import 'package:path/path.dart';
import 'package:safe_local_storage/safe_local_storage.dart';

const data = {'foo': 'bar'};

Future<void> main() async {
  final storage = SafeLocalStorage(location);
  await storage.write(data);
  print(await storage.read());
}

String get location {
  final script = Platform.script.toFilePath();
  final parent = File(script).parent.path;
  return join(parent, 'cache.json');
}
9
likes
160
pub points
79%
popularity

Publisher

unverified uploader

A safe caching library to read/write values on local storage.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

path, synchronized

More

Packages that depend on safe_local_storage