A lightweight Flutter package for managing offline data synchronization using SharedPreferences. Ideal for apps requiring offline-first functionality.

Features

Store and retrieve data locally using SharedPreferences. Automatically sync data when connectivity is restored. Customizable sync logic with an easy-to-use API. Minimal dependencies for better performance.

Getting started

To use this package, add the following to your pubspec.yaml:

dependencies:
simple_offline_sync: <latest_version>

Usage

Import the package:

import 'package:simple_offline_sync/simple_offline_sync.dart';

Save and retrieve local data:

final offlineSync = OfflineSync();

// Save data locally
await offlineSync.saveDataLocally('key', 'Offline Data');

// Retrieve data
final data = await offlineSync.getDataLocally('key');

//Sync data to server bool success = await offlineSync.syncDataToServer( syncKey, (data) async { // Simulate API call await Future.delayed(const Duration(seconds: 2)); debugPrint('Data synced to server: $data'); return true; // Return true if sync is successful }, );

Additional information

For detailed examples, check the /example folder. Contributions are welcome!

!

🚀 Welcome Contributions! 🎉 Contributions are open! 💡 Feel free to contribute by:

🆕 Adding more extensions ✨ Improving existing ones 🐞 Fixing bugs 💭 Suggesting new features

License This project is licensed under the MIT License.