Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Use maybeOf(context) instead of of(context) in order to check null value #337

Closed
wants to merge 1 commit into from

Conversation

Spitzbua
Copy link

@Spitzbua Spitzbua commented Feb 15, 2023

Description

Using the new flutter version 3.7 and above the call to Overlay.of(showCaseContext) throws an hard error on null value which breaks the previous behaviour. Instead make use of the maybeOf which returns null if no value is given.

Checklist

  • The title of my PR starts with a [Conventional Commit] prefix (fix:, feat:, docs: etc).
  • I have followed the [Contributor Guide] when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

Related Issues

Closes #330

final showCaseContext = ShowCaseWidget.of(context).context;
if (mounted) {
if (Overlay.maybeOf(showCaseContext) != null) {
Overlay.of(showCaseContext)!.insert(overlayEntry);
Copy link
Contributor

Choose a reason for hiding this comment

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

As you are using maybeOf so please also use it here. It will also fix the linting error.

Overlay.of(showCaseContext)!.insert(overlayEntry);
} else {
if (Overlay.maybeOf(context) != null) {
Overlay.of(context)!.insert(overlayEntry);
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here.

@ujas-m-simformsolutions
Copy link
Contributor

Build is failing due to 2 linting issue. Fixing comments will fix one of linting issue. Other issue is unrelated to file changes.

@vatsaltanna
Copy link
Collaborator

Closing this PR as this issue has already been fixed in PR: #288

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.

Overlay not showing in flutter 3.7.0
3 participants