Skip to content

fix: correct type comparison in _updateTaskStatus (Map vs bool)#227

Open
Muneerali199 wants to merge 1 commit intoAOSSIE-Org:mainfrom
Muneerali199:fix/task-status-type-comparison
Open

fix: correct type comparison in _updateTaskStatus (Map vs bool)#227
Muneerali199 wants to merge 1 commit intoAOSSIE-Org:mainfrom
Muneerali199:fix/task-status-type-comparison

Conversation

@Muneerali199
Copy link
Copy Markdown

Summary

Fixes #222

Corrects a wrong type comparison in task_detail_screen.dart where the result of updateTaskStatus() (which returns Map<String, dynamic>) was being compared directly to true (a bool). This comparison always evaluates to false, silently breaking success feedback.

Problem

SupabaseService.updateTaskStatus() returns Future<Map<String, dynamic>> with a 'success' key, not a bool. The original code:

// task_detail_screen.dart:81 (before)
if (result == true) {        // ❌ Map<String, dynamic> is never == true
  // success branch: NEVER reached
}

Because Map<String, dynamic> == true is always false, the success path was dead code — users never saw the success message or had the task detail updated after a status change.

Fix

// task_detail_screen.dart (after)
if (result['success'] == true) {   // ✅ correctly checks the Map's 'success' key
  // success branch now executes correctly
}

Before / After

Before (flutter analyze):

warning - lib/screens/tasks/task_detail_screen.dart:81:11
  Equality is always false because none of the instances of Map<String, dynamic> can equal true
  equality_check_with_different_types

After: zero equality_check_with_different_types warnings on this file.

Checklist

  • flutter analyze run — warning resolved
  • Fix matches the actual return type of SupabaseService.updateTaskStatus()
  • No other logic changed

updateTaskStatus() returns Future<Map<String, dynamic>> with a 'success'
key, not a bool. Comparing the Map directly to 'true' always evaluates
false, causing the success SnackBar to never appear and task details to
never reload after a status update.

- Renamed variable from 'success' to 'result' for clarity
- Fixed condition from 'result == true' to 'result["success"] == true'
- Show actual error message from result['error'] on failure
- Added extra mounted check after the inner await _loadTaskDetails()

Fixes AOSSIE-Org#222
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 13, 2026

Warning

Rate limit exceeded

@Muneerali199 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 14 minutes and 21 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: dd4163de-b21d-46a5-b2c8-a5531ca491fe

📥 Commits

Reviewing files that changed from the base of the PR and between 5afe656 and 36345c5.

📒 Files selected for processing (1)
  • lib/screens/tasks/task_detail_screen.dart
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Wrong type comparison in _updateTaskStatus() — success snackbar never shows

1 participant