• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Error: Method ‘addPostFrameCallback’ cannot be called on ‘WidgetsBinding?’ because it is potentially null

Resolved: Error: Method ‘addPostFrameCallback’ cannot be called on ‘WidgetsBinding?’ because it is potentially null

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I used animated_custom_dropdown: 1.2.2package and try this code to create a search bar with a dropdown. but I’m getting a huge error. how to solve this issue.
enter image description here
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/animated_custom_dropdown-1.2.2/lib/dropdown_overlay.dart:57:29: Error: Method ‘addPostFrameCallback’ cannot be called on ‘WidgetsBinding?’ because it is potentially null.
  • ‘WidgetsBinding’ is from ‘package:flutter/src/widgets/binding.dart’ (‘/C:/src/flutter/packages/flutter/lib/src/widgets/binding.dart’). Try calling using ?. instead. WidgetsBinding.instance.addPostFrameCallback((_) { ^^^^^^^^^^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/animated_custom_dropdown-1.2.2/lib/dropdown_overlay.dart:185:33: Error: No named parameter with the name ‘thumbVisibility’. thumbVisibility: MaterialStateProperty.all( ^^^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/scrollbar_theme.dart:33:9: Context: Found this candidate, but the arguments don’t match. const ScrollbarThemeData({ ^^^^^^^^^^^^^^^^^^

FAILURE: Build failed with an exception.
  • Where: Script ‘C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle’ line: 1102

  • What went wrong: Execution failed for task ‘:app:compileFlutterBuildDebug’.


Process ‘command ‘C:\src\flutter\bin\flutter.bat” finished with non-zero exit value 1


  • Try: Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output. Run with –scan to get full insights.

  • Get more help at https://help.gradle.org


BUILD FAILED in 48s Exception: Gradle task assembleDebug failed with exit code 1

Answer:

Downgrade the animated_custom_dropdown version to 1.2.1. The version you are using is upgraded to flutter 3.
Please check change log here

If you have better answer, please add a comment about this, thank you!

dart flutter flutter-dependencies
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: Azuer Service Bus SDK not receiving the specified messages

01/04/2023

Resolved: how to change date format from 201904 to Apr-19 in excel

01/04/2023

Resolved: Iterator for custom Hashtable C#

01/04/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.