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

In new Flutter, WidgetsBinding.instance will never be null. So, 4 annoying warnings poped up. Pls, fix these[0.2.2] #331

Closed
soarcreator opened this issue Feb 20, 2022 · 6 comments

Comments

@soarcreator
Copy link

Sorry for being lazy, but let me skip how to reproduce this because I think this is just to update and then to run.
Same Issues on a different rep: google/charts#735

I'm using visibility_detector 0.2.2 from https://pub.dev/packages/visibility_detector/install

: Warning: Operand of null-aware operation '?.' has type 'RendererBinding' which excludes null.
../…/src/visibility_detector_layer.dart:126
- 'RendererBinding' is from 'package:flutter[/src/rendering/binding.dart]()' ('.[./../../flutter/packages/flutter/lib/src/rendering/binding.dart]()').
package:flutter/…/rendering/binding.dart:1
    assert(RendererBinding.instance?.renderView != null);
                           ^

: Warning: Operand of null-aware operation '!' has type 'RendererBinding' which excludes null.
../…/src/visibility_detector_layer.dart:127
- 'RendererBinding' is from 'package:flutter[/src/rendering/binding.dart]()' ('.[./../../flutter/packages/flutter/lib/src/rendering/binding.dart]()').
package:flutter/…/rendering/binding.dart:1
    var clipRect = Offset.zero & RendererBinding.instance!.renderView.size;
                                                 ^

: Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null.
../…/src/visibility_detector_layer.dart:170
- 'SchedulerBinding' is from 'package:flutter[/src/scheduler/binding.dart]()' ('.[./../../flutter/packages/flutter/lib/src/scheduler/binding.dart]()').
package:flutter/…/scheduler/binding.dart:1
        SchedulerBinding.instance!.addPostFrameCallback((timeStamp) {
                         ^

: Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null.
../…/src/visibility_detector_layer.dart:193
- 'SchedulerBinding' is from 'package:flutter[/src/scheduler/binding.dart]()' ('.[./../../flutter/packages/flutter/lib/src/scheduler/binding.dart]()').
package:flutter/…/scheduler/binding.dart:1
    SchedulerBinding.instance!

                     ^
: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
../…/util/util.dart:10
- 'WidgetsBinding' is from 'package:flutter[/src/widgets/binding.dart]()' ('.[./../../flutter/packages/flutter/lib/src/widgets/binding.dart]()').
package:flutter/…/widgets/binding.dart:1
    WidgetsBinding.instance!.addPostFrameCallback((_) => callback());
@jamesderlin
Copy link
Collaborator

This was fixed already by #325.

@Wissperwind
Copy link

And is a Version including this fix already released?

@igolubic
Copy link

Any updates regarding this?

@justintoth
Copy link

Bump...

@RonanLB
Copy link

RonanLB commented Aug 13, 2022

Bump, it would be nice to see this fixed as this package is owned by google

@jamesderlin
Copy link
Collaborator

jamesderlin commented Aug 13, 2022

Bump, it would be nice to see this fixed as this package is owned by google

As I mentioned earlier, this should already be fixed, which is why this issue is closed. Have you tried the latest version of visibility_detector (0.3.3)?

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

No branches or pull requests

6 participants