Common Issues
Solutions to common Talon problems
Common Issues
Solutions to frequently encountered problems.
Messages Not Syncing
Symptoms: Changes stay in local database, never reach server.
Solutions:
- Check
syncIsEnabled = true - Verify ServerDatabase implementation
- Check network connectivity
- Look for errors in
sendMessageToServer()
// Debug: Check unsynced messages
final unsynced = await offlineDb.getUnsyncedMessages();
print('Unsynced: ${unsynced.length}');
Real-time Not Working
Symptoms: Changes from other devices don't appear.
Solutions:
- Verify subscription is active
- Check server-side realtime is enabled
- Ensure filters (userId, clientId) are correct
// Debug: Listen directly
talon.serverChanges.listen((change) {
print('Server change: ${change.messages.length} messages');
});
Wrong Data Winning
Symptoms: Older changes overwriting newer ones.
Solutions:
- Verify device clocks are reasonably accurate
- Check HLC timestamps are being generated
- Ensure
getExistingTimestamp()returns correct data
// Debug: Check timestamps
final message = offlineDb.messages.last;
print('HLC: ${message.localTimestamp}');
Duplicate Data
Symptoms: Same row appearing multiple times.
Solutions:
- Ensure unique IDs (
createNewIdFunction) - Check for duplicate inserts in
applyMessageToLocalDataTable()
Table Not Found
Symptoms: SQL errors about missing tables.
Solutions:
- Ensure
init()runs before using Talon - Verify table creation SQL is correct
- Check database path
Data Not Persisting
Symptoms: Data disappears after app restart.
Solutions:
- Verify database is opened correctly
- Check for database deletion on init
- Ensure transactions are committed
Stream Subscription Leaks
Symptoms: Memory usage grows over time.
Solutions:
// Always cancel subscriptions
late StreamSubscription _sub;
@override
void initState() {
_sub = talon.changes.listen((_) => refresh());
}
@override
void dispose() {
_sub.cancel(); // Don't forget!
super.dispose();
}
Getting Help
If you're still stuck:
- Check GitHub Issues
- Create a minimal reproduction
- Include Talon version and platform