simple_offline_sync 0.0.1 copy "simple_offline_sync: ^0.0.1" to clipboard
simple_offline_sync: ^0.0.1 copied to clipboard

A Flutter package for offline syncing.

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.

3
likes
130
points
11
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for offline syncing.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

connectivity_plus, dio, flutter, riverpod, shared_preferences

More

Packages that depend on simple_offline_sync