Skip to content

fix unnecessary null-aware operators in device.dart#8754

Merged
krushnarout merged 1 commit into
mainfrom
fix/device-page-null-aware-operator
Jul 2, 2026
Merged

fix unnecessary null-aware operators in device.dart#8754
krushnarout merged 1 commit into
mainfrom
fix/device-page-null-aware-operator

Conversation

@krushnarout

@krushnarout krushnarout commented Jul 1, 2026

Copy link
Copy Markdown
Member

Summary

  • connectedDevice?.name?.toLowerCase() and connectedDevice?.type inside the onTap closure at device.dart triggered analyzer errors — the closure only runs when provider.connectedDevice != null is already checked, so ?. short-circuits to null and never reaches .toLowerCase().
  • BtDevice.name is non-nullable, so ?.toLowerCase() ?? '' was also dead code.

Test plan

  • Analyzer warnings for invalid_null_aware_operator at device.dart:240 resolved
  • Manual smoke test of the "product update" OTA routing tap in the app (not run — logic-only diff, no compiled/launched app in this session)

🤖 Generated with Claude Code

Review in cubic

connectedDevice is already null-checked before this closure runs, and
BtDevice.name is non-nullable, so the ?. and ?? '' were both dead code
flagged by the analyzer.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean fix. Verified that BtDevice.name is non-nullable (String name) and the onTap closure is guarded by provider.connectedDevice != null, so the !. assertions are safe and the previous ?. chains were correctly flagged as unnecessary by the analyzer. Lint & Format check passes. Thanks @krushnarout!

@krushnarout krushnarout merged commit b4baef8 into main Jul 2, 2026
3 checks passed
@krushnarout krushnarout deleted the fix/device-page-null-aware-operator branch July 2, 2026 05:00
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.

2 participants