This Flutter project demonstrates a note-taking app with offline-first support using:
flutter_blocfor state managementsqflitefor local storage- REST API (built with Golang + JWT) for remote syncing
flutter_offlinefor detecting network connectivity
Aplikasi ini menggunakan Flutter sebagai UI framework utama dan BLoC untuk manajemen state. Untuk deteksi koneksi jaringan, digunakan plugin connectivity_plus dan untuk mendukung mode offline, digunakan SQLite melalui paket sqflite. Data dicatat secara lokal, kemudian disinkronisasi ke server REST API berbasis Golang (Gin) dengan autentikasi JWT dan penyimpanan data menggunakan MySQL. Aplikasi ini mendukung sinkronisasi otomatis maupun manual saat perangkat kembali online.
git clone https://github.com/yogithesymbian/yo-simple-notes-offline-online-auto-sync.git
cd flutter_notes_sync_blocflutter pub getflutter runMake sure to have your emulator/device running.
To obtain an access token, make a POST request to the login endpoint:
curl -X POST \
'https://yo-simple-notes-railways-production.up.railway.app/login' \
--header 'Content-Type: application/json' \
--data-raw '{
"username": "admin",
"password": "admin123"
}'Response will contain a JWT token. Replace this token in:
// lib/services/note_service.dart
headers: {
'Content-Type': 'application/json',
'Authorization': '<PUT_YOUR_JWT_TOKEN_HERE>'
},// lib/services/note_service.dart
http://192.168.43.5:8080
replace all with:
https://yo-simple-notes-railways-production.up.railway.app- ✅ Add, update, delete notes
- ✅ Mark notes as done/undone
- ✅ Save notes locally using SQLite (offline-first)
- ✅ Sync to remote server (if online)
- ✅ Auto-sync when internet comes back online
- ✅ Manual "Sync Now" button
lib/
├── bloc/ # BLoC state management
├── models/ # Note model
├── services/ # NoteService (SQLite + API)
├── pages/ # UI screens (HomePage)
-
The backend is built with Golang, uses MySQL, and supports JWT auth
-
Endpoints:
POST /loginGET /notesPOST /notesPATCH /notes/:idDELETE /notes/:id
dependencies:
flutter:
sdk: flutter
flutter_bloc: ^8.1.6
flutter_offline: ^3.0.1
sqflite: ^2.3.2
path_provider: ^2.1.1
http: ^0.13.6- Make sure the backend server is accessible from your emulator/device
- If you're testing on a physical Android device, use IP (e.g.
192.168.x.x) instead oflocalhost - Database persistence will survive hot restart, but not full rebuild if you're using in-memory DB
- Form to add/edit notes
- Undo delete
- Search and filter notes
- prevent duplicate on refetchFromServer
