im getting these errors and dont know how to fix them.
../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_platform_widgets-1.20.0/lib/src/platform_button.dart:269:14: Error: The method 'FlatButton' isn't defined for the class 'PlatformButton'.
- 'PlatformButton' is from 'package:flutter_platform_widgets/src/platform_button.dart' ('../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_platform_widgets-1.20.0/lib/src/platform_button.dart').
Try correcting the name to the name of an existing method, or defining a method named 'FlatButton'.
return FlatButton(
^^^^^^^^^^
../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_platform_widgets-1.20.0/lib/src/platform_button.dart:302:12: Error: The method 'RaisedButton' isn't defined for the class 'PlatformButton'.
- 'PlatformButton' is from 'package:flutter_platform_widgets/src/platform_button.dart' ('../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_platform_widgets-1.20.0/lib/src/platform_button.dart').
Try correcting the name to the name of an existing method, or defining a method named 'RaisedButton'.
return RaisedButton(
^^^^^^^^^^^^
../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_platform_widgets-1.20.0/lib/src/platform_dialog_action.dart:171:14: Error: The method 'FlatButton' isn't defined for the class 'PlatformDialogAction'.
- 'PlatformDialogAction' is from 'package:flutter_platform_widgets/src/platform_dialog_action.dart' ('../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_platform_widgets-1.20.0/lib/src/platform_dialog_action.dart').
Try correcting the name to the name of an existing method, or defining a method named 'FlatButton'.
return FlatButton(
^^^^^^^^^^
6
Answers
If you’re on the latest version of Flutter, Flatbutton is deprecated, use TextButton instead.
Check the last package you added in pubspec.yaml and delete it and see if no error occurs then the error is because the package
for more details…
https://docs.flutter.dev/release/breaking-changes/buttons#context
You just have to change the velocity_x:old version to new version.
For Eg:
in pubspec.yaml
dependencies:
velocity_x:^1.4.1 change it to ^3.2.1
FlatButton is deprecated and totally removed from flutter after flutter 2.1.0
Use TextButton instead of FlatButton as follows:
As seen from Flutter Documentation:
Old Widgets have been removed, Now you have to use the new widget along with the new theme. Here is a quick guide on how to use them.