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

A package that helps developers manage offline data storage and synchronization with a backend service.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:offline_storage_sync/offline_storage_sync.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  final localStorage = LocalStorage();
  await localStorage.init();

  final cacheStorage = CacheStorage();
  await cacheStorage.init();

  final syncService = SyncService(localStorage, cacheStorage, 'https://your-backend-url.com');

  runApp(MyApp(syncService: syncService));
}

class MyApp extends StatelessWidget {
  final SyncService syncService;

  MyApp({required this.syncService});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('Offline Storage Sync Example'),
        ),
        body: Center(
          child: ElevatedButton(
            onPressed: () async {
              final data = DataModel(id: 1, data: 'Sample Data');
              await syncService.syncData();
            },
            child: Text('Sync Data'),
          ),
        ),
      ),
    );
  }
}
5
likes
50
points
34
downloads

Publisher

unverified uploader

Weekly Downloads

A package that helps developers manage offline data storage and synchronization with a backend service.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter, hive, http, path, plugin_platform_interface, sqflite

More

Packages that depend on offline_storage_sync