I have flutter application under development. When running the app , an error occurs Method not found: 'ButtonTheme.bar'. I tried cleaning the project. but still same error persists
/C:/Users/RdpUser/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/date_range_picker-1.0.6/lib/date_range_picker.dart:1152:44: Error: Method not found: 'ButtonTheme.bar'.
final Widget actions = new ButtonTheme.bar(
^^^
Failed to compile application.
Click on the error link to go in my_alert_dialog.dart and change ButtonTheme.bar to ButtonBarTheme like this :
change to :
It's works !
The temporary solution @pepe-calero referred would look like this:
Add the following section in your pubspec.yaml
dependency_overrides:
date_range_picker:
git:
url: https://github.com/LempereurBenjamin/date_range_picker
Use this,
Deprecated. Please use ButtonBarTheme instead which offers more flexibility to configure ButtonBar widgets.
This feature was deprecated after v1.9.1.
Because ButtonTheme.bar
is deprecated.
For reference, https://api.flutter.dev/flutter/material/ButtonTheme/ButtonTheme.bar.html
I just updated flutter and I also keep getting this error. I agree with @PatelFab, ButtonTheme.bar is deprecated. If you are using ButtonTheme.bar "directly" in your code, just change it to ButtonBarTheme.
Another solution would be to use the flutter showDateRangePicker function.
I have the problem of not using ButtonTheme.bar "directly", but another package I depend on uses it: flutter_form_builder. In case you use flutter_form_builder, the issue has already been posted in github and I bet they're working on it.
I'll update when it's solved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With