zeba_academy_offline_db 0.0.2
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:


π¦ 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:
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.