Question:
I usedanimated_custom_dropdown: 1.2.2
package and try this code to create a search bar with a dropdown. but I’m getting a huge error. how to solve this issue.
/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!