Skip to content

Conversation

@krushnarout
Copy link
Member

closes #3764

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request addresses a critical bug where incorrect conversation details could be displayed due to improper handling of null returns from getConversationDateAndIndex. The review includes suggestions to ensure robust state management within the conversation_provider.dart method, aligning with the principle that provider methods should handle state management to prevent UI-level data inconsistencies. This ensures the detail page always displays the correct conversation, preventing potential data corruption or user confusion.

@aaravgarg aaravgarg requested a review from mdmohsin7 December 15, 2025 16:18
// Ensure the provider has the conversation data from the widget parameter
provider.setCachedConversation(widget.conversation);

conversationProvider.groupConversationsByDate();
Copy link
Member

Choose a reason for hiding this comment

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

why do we have to group them here?

Copy link
Member Author

Choose a reason for hiding this comment

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

so that grouped state exists before both index lookup and updates, preventing wrong indexing and null crash

Copy link
Collaborator

Choose a reason for hiding this comment

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

@mdmohsin7 man don't hesitate with @krushnarout and feel free to merge the PR once you see it's good.

@krushnarout
Copy link
Member Author

@mdmohsin7 fixed conflicts, pls review thank you

@mdmohsin7 mdmohsin7 merged commit e84a326 into main Jan 5, 2026
1 check passed
@mdmohsin7 mdmohsin7 deleted the fix/null-crash branch January 5, 2026 14:36
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.

FlutterError - Null check operator used on a null value

4 participants