⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@krushnarout
Copy link
Member

context.read<MessageProvider>().setMessagesFromCache();
context.read<AppProvider>().setAppsFromCache();
context.read<MessageProvider>().refreshMessages();
context.read<UsageProvider>().fetchSubscription();
context.read<TaskIntegrationProvider>().loadFromBackend();

here it tried to use the widget after it was disposed and moved the provider lookup before the async call and added a mounted check

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 aims to fix potential crashes by avoiding BuildContext access after asynchronous operations, which is a great improvement for the app's stability. The changes correctly apply the recommended pattern of checking mounted after await and extracting provider lookups before await.

However, I've found a couple of places within the modified code block in initState where this pattern was not fully applied, leaving potential use_build_context_synchronously violations. My review comments point these out with suggestions for a complete fix to ensure the initState logic is fully robust against this class of errors.

@aaravgarg
Copy link
Collaborator

/gemini review

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 correctly addresses potential crashes by preventing the use of BuildContext across asynchronous gaps. The changes involve moving provider lookups before await calls and adding mounted checks, which is a solid improvement for the app's stability. I've identified one critical issue related to deep link handling that could lead to a crash and have provided a suggestion to resolve it.

@beastoin
Copy link
Collaborator

Guarding with mounted every time is not the way. Tell me exactly what the cause is at the line of code level.

@beastoin beastoin closed this Jan 10, 2026
@github-actions
Copy link
Contributor

Hey @krushnarout 👋

Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request.

After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our roadmap and vision

Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out.

Thank you for being part of the Omi community! 💜

@krushnarout
Copy link
Member Author

Guarding with mounted every time is not the way. Tell me exactly what the cause is at the line of code level.

I have removed the extra mounted checks.

context.read<MessageProvider>().setMessagesFromCache();

in this line the crash happened, the provider was accessed after an async boundary inside a post frame callback. I moved provider reads before the async call and did the same for the other providers

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 - _AppShellState.initState.<fn>

4 participants