The method 'FlatButton' isn't defined for the class 'UpdateMenu'.
Opened this issue · 1 comments
clovett commented
Launching lib\main.dart on Chrome in debug mode...
lib/screens/update_menu.dart:33:13: Error: The method 'FlatButton' isn't defined for the class 'UpdateMenu'.
- 'UpdateMenu' is from 'package:getx_restaurant/screens/update_menu.dart' ('lib/screens/update_menu.dart').
Try correcting the name to the name of an existing method, or defining a method named 'FlatButton'.
FlatButton(
^^^^^^^^^^
Failed to compile application.
tataDan commented
I got the same error. Apparently FlatButton is deprecated. I changed the relevant code to this:
// FlatButton(
TextButton(
style: ButtonStyle(
foregroundColor:
MaterialStateProperty.all<Color>(Colors.deepOrange)),
child: const Text(
"Submit",
style: TextStyle(color: Colors.white),
),
onPressed: () => {},
// color: Colors.deepOrange,
),
The error disappeared and the application ran. However, I am not certain that this is the best way to resolve the issue.