io library

File-backed stores for apps that run on the Dart VM or Flutter on mobile and desktop (anything with dart:io). Not available on the web, where JsonCacheStore and JsonWriteQueueStore work over localStorage or shared_preferences instead.

import 'package:wordpress_client/io.dart';
import 'package:wordpress_client/wordpress_client.dart';

final dir = (await getApplicationSupportDirectory()).path;
final queue = OfflineWriteQueue(store: FileWriteQueueStore('$dir/wp_queue.json'));
final cache = CacheMiddleware(cache: FileCacheStore('$dir/wp_cache.json'));

Classes

FileCacheStore
A JsonCacheStore kept in the file at path (created on first write, with any missing parent directories).
FileWriteQueueStore
A JsonWriteQueueStore kept in the file at path (created on first write, with any missing parent directories).