Error: No named parameter with the name 'onPressed'

Issue

So, i’m trying to create an app in flutter and cannot work my way around the syntax code. The error is that it is not able to recognise onPressed. Ps new to flutter.

enter image description here

Solution

The problem is you’re trying to call onPressed on a Center widget which has no onPressed parameter.

Try calling onPressed on a RaisedButton or any other widget that has an onPressed parameter instead:

RaisedButton(
onPressed: //Your function here,
),

Answered By – Sam

Answer Checked By – Marie Seifert (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *