Warning: Operand of null-aware operation '!' has type 'ScheduerBinding' which excludes null

662

This error comes after upgrading to flutter 3


This isn't perfect solution but it worked for me
I got that error because of getx, so I update getx plugin version and everything working fine.

Try to update plugins or downgrade flutter version.

Share:
662
GOKU
Author by

GOKU

Joined VTree on October 2020. Loves to take control of the situation. Good at JAVA, Golang, MongoDb, Flutter, MySQL, C, C++. Familiar with Windows and Linux Platforms. I always enjoy a challenge, and can work well under pressure; my other strengths are a strong commitment to customer services, and attention to detail. I am highly motivated and enjoy challenges within a new or existing role, and feel I am flexible enough to meet the needs of any degree course.

Updated on January 04, 2023

Comments

  • GOKU
    GOKU 10 months

    I stared facing this issue after Flutter upgrade. 3.0.1

    The app works but there are error/s (warning/s) in the terminal).

    It seems like a Binding issue.

    the error(warning) says: Warning: Operand of null-aware operation '!' has type 'ScheduerBinding' which excludes null.

    /C:/Software%20Utilities/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_math_fork-0.5.0/lib/src/widgets/selectable.dart:459:24: Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null.
    
    - 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('/C:/Software%20Utilities/flutter/packages/flutter/lib/src/scheduler/binding.dart').
    
          SchedulerBinding.instance!.addPostFrameCallback((_) {
    
                           ^
    
    /C:/Software%20Utilities/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_math_fork-0.5.0/lib/src/widgets/selection/web_selection_manager.dart:119:24: Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null.
    
    - 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('/C:/Software%20Utilities/flutter/packages/flutter/lib/src/scheduler/binding.dart').
    
          SchedulerBinding.instance!
    
                           ^
    
    /C:/Software%20Utilities/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_math_fork-0.5.0/lib/src/widgets/selection/overlay_manager.dart:138:28: Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null.
    
    - 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('/C:/Software%20Utilities/flutter/packages/flutter/lib/src/scheduler/binding.dart').
    
          if (SchedulerBinding.instance!.schedulerPhase ==
    
                               ^
    
    /C:/Software%20Utilities/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_math_fork-0.5.0/lib/src/widgets/selection/overlay_manager.dart:140:26: Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null.
    
    - 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('/C:/Software%20Utilities/flutter/packages/flutter/lib/src/scheduler/binding.dart').
    
            SchedulerBinding.instance!
    
                             ^
    
    /C:/Software%20Utilities/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_math_fork-0.5.0/lib/src/widgets/selection/overlay.dart:141:26: Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null.
    
    - 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('/C:/Software%20Utilities/flutter/packages/flutter/lib/src/scheduler/binding.dart').
    
        if (SchedulerBinding.instance!.schedulerPhase ==
    
                             ^
    
    /C:/Software%20Utilities/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_math_fork-0.5.0/lib/src/widgets/selection/overlay.dart:143:24: Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null.
    
    - 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('/C:/Software%20Utilities/flutter/packages/flutter/lib/src/scheduler/binding.dart').
    
          SchedulerBinding.instance!.addPostFrameCallback(_markNeedsBuild);
    
                           ^
    
    /C:/Software%20Utilities/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_math_fork-0.5.0/lib/src/widgets/selection/overlay.dart:193:26: Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null.
    
    - 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('/C:/Software%20Utilities/flutter/packages/flutter/lib/src/scheduler/binding.dart').
    
        if (SchedulerBinding.instance!.schedulerPhase ==
    
                             ^
    
    /C:/Software%20Utilities/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_math_fork-0.5.0/lib/src/widgets/selection/overlay.dart:195:24: Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null.
    
    - 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('/C:/Software%20Utilities/flutter/packages/flutter/lib/src/scheduler/binding.dart').
    
          SchedulerBinding.instance!.addPostFrameCallback(_markNeedsBuild);
    
                           ^
    

    Ran flutter doctor found no issues...

    here is Flutter Doctor output:

    [√] Flutter (Channel stable, 3.0.1, on Microsoft Windows [Version 10.0.22000.675], locale en-IN)
    
        • Flutter version 3.0.1 at C:\Software Utilities\flutter
    
        • Upstream repository https://github.com/flutter/flutter.git
    
        • Framework revision fb57da5f94 (8 days ago), 2022-05-19 15:50:29 -0700
    
        • Engine revision caaafc5604
    
        • Dart version 2.17.1
    
        • DevTools version 2.12.2
    
     
    
    [√] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    
        • Android SDK at C:\Users\Vinay H P\AppData\Local\Android\sdk
    
        • Platform android-32, build-tools 32.0.0
    
        • Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
    
        • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
    
        • All Android licenses accepted.
    
     
    
    [√] Chrome - develop for the web
    
        • CHROME_EXECUTABLE = C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe
    
     
    
    [√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.0.4)
    
        • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    
        • Visual Studio Community 2022 version 17.0.32014.148
    
        • Windows 10 SDK version 10.0.19041.0
    
     
    
    [√] Android Studio (version 2020.3)
    
        • Android Studio at C:\Program Files\Android\Android Studio
    
        • Flutter plugin can be installed from:
    
           https://plugins.jetbrains.com/plugin/9212-flutter
    
        • Dart plugin can be installed from:
    
           https://plugins.jetbrains.com/plugin/6351-dart
    
        • Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
    
     
    
    [√] Android Studio (version 2021.2)
    
        • Android Studio at C:\Program Files\Android\Android Studio1
    
        • Flutter plugin can be installed from:
    
           https://plugins.jetbrains.com/plugin/9212-flutter
    
        • Dart plugin can be installed from:
    
           https://plugins.jetbrains.com/plugin/6351-dart
    
        • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
    
     
    
    [√] IntelliJ IDEA Community Edition (version 2022.1)
    
        • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2022.1
    
        • Flutter plugin can be installed from:
    
           https://plugins.jetbrains.com/plugin/9212-flutter
    
        • Dart plugin version 221.5480
    
     
    
    [√] Connected device (4 available)
    
        • Redmi Note 3 (mobile) • 754f4dd • android-arm64  • Android 6.0.1 (API 23)
    
        • Windows (desktop)     • windows • windows-x64    • Microsoft Windows [Version 10.0.22000.675]
    
        • Chrome (web)          • chrome  • web-javascript • unknown
    
        • Edge (web)            • edge    • web-javascript • Microsoft Edge 101.0.1210.53
    
     
    
    [√] HTTP Host Availability
    
        • All required HTTP hosts are available
    
     
    
    • No issues found!
    
  • GOKU
    GOKU over 1 year
    I am not using getx but pub upgrade didn't work.
  • GOKU
    GOKU over 1 year
    Error was from flutter_html package. I think we need to wait till the packages are updated...
  • Jeremy Caney
    Jeremy Caney over 1 year
    But that's an alpha release of a now-released version. I assume it carries with it other bugs. It may be worth highlighting those (e.g., by linking to a known issues page).