Giter Site home page Giter Site logo

Comments (5)

brianegan avatar brianegan commented on July 20, 2024 1

It's not quite the same -- if you read, it's actually the opposite haha.

In the reported issue above, the error is:

Warning: Operand of null-aware operation '?.' has type 'WidgetsBinding' which excludes null.

In your report, the error is:

Error: Method 'addPostFrameCallback' cannot be called on 'WidgetsBinding?' because it is potentially null.

I hope you can understand, but as Flutter updates, so must this library. In this case, Flutter has made a breaking change, this library has adapted to support that change.

If you need to support Flutter 2, the previous versions should work, but sadly I do not have time to backport bug fixes. I'll add a note in the README.

from flutter_redux.

brianegan avatar brianegan commented on July 20, 2024

There's already a beta version out which solves this problem , a new version 0.10.0 will also provide a new stable version with this functionality.

from flutter_redux.

tudor07 avatar tudor07 commented on July 20, 2024

@brianegan this issue still occurs on flutter_redux: 0.10.0 and Flutter 2.10.3

from flutter_redux.

brianegan avatar brianegan commented on July 20, 2024

@tudor07 Thanks for the report. Is it the exact same error message, or is it complaining that WidgetsBinding.instance must be nullable? Version 0.10.0 was built to support Flutter 3+ and may not work with older versions.

If it's the same message, please look at the code for your local version of flutter_redux 0.10.0 and see if the ? still exist on line 474 & 576. If it does not, then something odd is happening and I may need to publish a new version.

The local code should be in ~/.pub-cache/hosted/pub.dartlang.org/flutter_redux-0.10.0.

The two lines that contain Widgetbindings.instance should look like:

https://github.com/brianegan/flutter_redux/blob/master/lib/flutter_redux.dart#L474
https://github.com/brianegan/flutter_redux/blob/master/lib/flutter_redux.dart#L576

from flutter_redux.

tudor07 avatar tudor07 commented on July 20, 2024

The code is exactly like the one you provided.

The full error message:

../../../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_redux-0.10.0/lib/flutter_redux.dart:474:31: Error: Method 'addPostFrameCallback'
    cannot be called on 'WidgetsBinding?' because it is potentially null.
     - 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../../dev/flutter/packages/flutter/lib/src/widgets/binding.dart').
    Try calling using ?. instead.
          WidgetsBinding.instance.addPostFrameCallback((_) {
                                  ^^^^^^^^^^^^^^^^^^^^
    ../../../../dev/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_redux-0.10.0/lib/flutter_redux.dart:576:31: Error: Method 'addPostFrameCallback'
    cannot be called on 'WidgetsBinding?' because it is potentially null.
     - 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../../dev/flutter/packages/flutter/lib/src/widgets/binding.dart').
    Try calling using ?. instead.
          WidgetsBinding.instance.addPostFrameCallback((_) {
                                  ^^^^^^^^^^^^^^^^^^^^

Looks like the library is no longer compatible with Flutter 2 😔
It would be nice to fix this and still being able to use it for folks who didn't upgrade to Flutter 3 yet.
If that is not possible maybe it's worth adding a warning in the docs.

from flutter_redux.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.