There appears to be nothing wrong with the code I have for my ElevatedButton, but It's giving me this error:
TextButton(
onPressed: () { },
child: Text('TextButton'),
)
This is even posted from the official Flutter website.
Any idea why it's doing this?
It's suspected that your button is a child of a widget that's marked as constant widget, if so, just remove const
keyword from parents of that button.
That's because onPressed()
can't be declared on a constant scope.