Parse Offline Extension
An extension package that adds offline caching functionality to Parse Server SDK Flutter.
Features
- Save ParseObjects to local cache
- Load ParseObjects from local cache
- Remove objects from cache
- Check if objects exist in cache
- Batch operations for multiple objects
- Get count of cached objects
Getting started
Add this package to your pubspec.yaml
:
dependencies:
parse_offline_extension: ^1.0.0
parse_server_sdk_flutter: ^8.0.0
Usage
Import the package and the extension methods will be automatically available on ParseObject instances:
import 'package:parse_offline_extension/parse_offline_extension.dart';
import 'package:parse_server_sdk_flutter/parse_server_sdk_flutter.dart';
// Save an object to local cache
ParseObject object = ParseObject('MyClass');
object.set('name', 'Test');
await object.saveToLocalCache();
// Load objects from cache
List<ParseObject> cachedObjects = await ParseObjectOffline.loadAllFromLocalCache('MyClass');
// Check if object exists in cache
bool exists = await object.existsInLocalCache();
// Remove from cache
await object.removeFromLocalCache();
Additional information
This extension uses the CoreStore from Parse SDK to persist objects locally. Objects are stored as JSON strings and can be retrieved even when offline.