Search code examples
fluttermobilepluginsmarquee

Flutter 3.0 : Getting error after adding and using the marquee plugin in flutter


After i added the marquee plugin and used it, I always get this error

../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/fading_edge_scrollview-2.0.1/lib/src/fading_edge_scrollview.dart:195:20: Warning: Operand of null-aware operation '?.' has type 'WidgetsBinding' which excludes null.
 - 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../development/flutter/packages/flutter/lib/src/widgets/binding.dart').
    WidgetsBinding.instance?.let((it) {
                   ^
../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/fading_edge_scrollview-2.0.1/lib/src/fading_edge_scrollview.dart:220:20: Warning: Operand of null-aware operation '?.' has type 'WidgetsBinding' which excludes null.
 - 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../development/flutter/packages/flutter/lib/src/widgets/binding.dart').
    WidgetsBinding.instance?.removeObserver(this);

I removed the plugin and deleted the marquee and the application is running without an error. Is there something wrong with the marquee plugin ?

               ^

Solution

  • Unfortunately Flutter 3.0.0 introduced some changes in the nullability of some properties.

    The most common packages that are still actively being developed released updated versions to support it.

    fading_edge_scrollview seems the be the one here that doesn't have an updated version (yet). I have no idea if it's being actively developed.

    You could try to fork it and fix it yourself, or you could just ignore the warning. Because it is in fact only a warning. Your app should still work properly even with those warnings.