Is there an existing issue for this?
What happened?
In lib/screens/tasks/task_detail_screen.dart, the _updateTaskStatus() method compares the return value of updateTaskStatus() against the boolean true. However, updateTaskStatus() returns Future<Map<String, dynamic>>, not a bool. Comparing a Map to a bool is always false in Dart, so the success branch is unreachable — the success SnackBar never shows, and the task details are never reloaded after a status update.
Root Cause
// supabase_service.dart:1349
Future<Map<String, dynamic>> updateTaskStatus({...}) async {
// returns {'success': true, ...} or {'success': false, 'error': ...}
}
// task_detail_screen.dart:81 — WRONG
final success = await _supabaseService.updateTaskStatus(...);
if (success == true) { // ❌ Map == bool is ALWAYS false
// This block is NEVER reached
ScaffoldMessenger.of(context).showSnackBar(...success message...);
} else {
// This block ALWAYS runs, even on actual success
ScaffoldMessenger.of(context).showSnackBar(...failure message...);
}
Steps to Reproduce
- Open any task in the task detail screen
- Change the task status (e.g. from "open" to "in_progress")
- Observe: "Failed to update task status" error snackbar always shows, even when the update succeeds in the database
Expected Behavior
- On success: show "Task status updated to ..." green snackbar and reload task details
- On failure: show "Failed to update task status" red snackbar
Actual Behavior
- Always shows the failure red snackbar regardless of actual result
Fix
// CORRECT — read the 'success' key from the returned Map
final result = await _supabaseService.updateTaskStatus(...);
if (result['success'] == true) {
await _loadTaskDetails();
ScaffoldMessenger.of(context).showSnackBar(...success...);
} else {
ScaffoldMessenger.of(context).showSnackBar(...failure...);
}
Evidence
flutter analyze flags this:
info - The type of the right operand ('bool') isn't a subtype or a supertype
of the left operand ('Map<String, dynamic>')
— lib/screens/tasks/task_detail_screen.dart:81:21 — unrelated_type_equality_checks
Record
Is there an existing issue for this?
What happened?
In
lib/screens/tasks/task_detail_screen.dart, the_updateTaskStatus()method compares the return value ofupdateTaskStatus()against the booleantrue. However,updateTaskStatus()returnsFuture<Map<String, dynamic>>, not abool. Comparing aMapto aboolis alwaysfalsein Dart, so the success branch is unreachable — the success SnackBar never shows, and the task details are never reloaded after a status update.Root Cause
Steps to Reproduce
Expected Behavior
Actual Behavior
Fix
Evidence
flutter analyzeflags this:Record