zeba_academy_offline_db 0.0.2 copy "zeba_academy_offline_db: ^0.0.2" to clipboard
zeba_academy_offline_db: ^0.0.2 copied to clipboard

Offline-first database system for Flutter with hybrid SQLite + Hive storage, automatic background sync, encrypted local data, and offline API request queue.

zeba_academy_offline_db #

πŸš€ A powerful offline‑first database system for Flutter with hybrid storage, automatic background synchronization, and encrypted local data.

This package helps Flutter developers build offline‑capable apps using SQLite + Hive hybrid storage, ensuring reliable data persistence even without internet connectivity.


✨ Features #

  • πŸ“¦ Offline‑first architecture
  • πŸ—„ Hybrid database system (SQLite + Hive)
  • πŸ” Encrypted local storage
  • πŸ”„ Automatic background API synchronization
  • ⚑ Offline API request queue
  • πŸ” Automatic retry system
  • πŸ“‘ Connectivity‑based sync
  • πŸ”” Stream‑based live data updates
  • 🧠 Conflict resolution system
  • πŸ“± Built specifically for Flutter apps

πŸ“Έ Screenshots #

Add screenshots inside a screenshots/ folder.

screenshots/
   offline_ui.png
   offline_records.png
   offline_add.png

Example:

![Offline Database UI](screenshots/offline_ui.png)
![Stored Records](screenshots/offline_records.png)

πŸ“¦ Installation #

Add the package to your pubspec.yaml:

dependencies:
  zeba_academy_offline_db: ^1.0.0

Then run:

flutter pub get

πŸš€ Quick Start #

Initialize the database and start the sync service.

import 'package:zeba_academy_offline_db/zeba_academy_offline_db.dart';

void main() async {

  WidgetsFlutterBinding.ensureInitialized();

  await HiveService.init();

  SyncService.start();

  runApp(MyApp());
}

πŸ—„ Insert Data (Offline) #

await DatabaseService.insertRecord({
  "id": "1",
  "data": "Hello Offline World",
  "updatedAt": DateTime.now().millisecondsSinceEpoch
});

πŸ“₯ Read Stored Records #

final records = await DatabaseService.getRecords();

πŸ“‘ Offline API Queue #

Queue API requests when the device is offline.

RequestQueue.add(
  ApiRequest(
    url: "https://api.example.com/data",
    method: "POST",
  ),
);

The package will automatically:

  • retry failed requests
  • sync when internet connection returns
  • maintain queue integrity

πŸ”” Live Data Streams #

Use reactive streams to update UI automatically.

final stream = DataStream<String>();

stream.update(["Item 1","Item 2"]);

stream.stream.listen((data){
  print(data);
});

🧠 Architecture #

The package uses a hybrid storage architecture:

Flutter App
     β”‚
     β–Ό
Offline Database Layer
     β”‚
 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
 β”‚   SQLite DB   β”‚  β†’ Persistent structured storage
 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
     β”‚
 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
 β”‚     Hive      β”‚  β†’ Fast local cache
 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
     β”‚
     β–Ό
Sync Engine
     β”‚
Offline Request Queue
     β”‚
API Server

πŸ“ Example #

A complete example app is included in the /example folder.

Run it with:

cd example
flutter run

πŸ§ͺ Running Tests #

flutter test

πŸ“œ License #

This project is licensed under the GPL License.


πŸ‘¨β€πŸ’» About Me #

✨ I’m Sufyan bin Uzayr, an open‑source developer passionate about building and sharing meaningful projects.

You can learn more about me and my work at:

https://sufyanism.com/

Connect with me on LinkedIn:

https://www.linkedin.com/in/sufyanism


πŸŽ“ Zeba Academy #

Your all‑in‑one learning hub! #

πŸš€ Explore courses and resources in coding, tech, and development at zeba.academy and code.zeba.academy.

Empower yourself with practical skills through curated tutorials, real‑world projects, and hands‑on experience. Level up your tech game today! πŸ’»βœ¨

Zeba Academy is a learning platform dedicated to coding, technology, and development.

➑ Visit our main site: https://zeba.academy

➑ Explore hands‑on courses and resources: https://code.zeba.academy

➑ Check out our YouTube for tutorials: https://www.youtube.com/@zeba.academy

➑ Follow us on Instagram: https://www.instagram.com/zeba.academy/


⭐ If you find this package useful, consider starring the repository and sharing it with others.

0
likes
130
points
124
downloads

Documentation

API reference

Publisher

verified publisherzeba.academy

Weekly Downloads

Offline-first database system for Flutter with hybrid SQLite + Hive storage, automatic background sync, encrypted local data, and offline API request queue.

Homepage

Topics

#flutter #offline #database #sqlite #hive

License

unknown (license)

Dependencies

connectivity_plus, encrypt, flutter, hive, hive_flutter, http, path, rxdart, sqflite

More

Packages that depend on zeba_academy_offline_db