Home > Net >  onTap: () async {} => moveToHome(context), in this line "=>" this is giving me error
onTap: () async {} => moveToHome(context), in this line "=>" this is giving me error

Time:06-27

Expected to find ')'.dart(expected_token)It is shown in the image

CodePudding user response:

Change

onTap: () async {} => moveToHome(context),

To:

onTap: () async {
  moveToHome(context);
},

Or:

onTap: () async => moveToHome(context),

CodePudding user response:

You can use the method in different ways. Writing a few here

onTap: () => moveToHome(context),

Or

onTap : (){ moveToHome(context);},

if you want to call an async method you can try

onTap: () async{ await moveToHome(context);}

Or

onTap: () async => moveToHome(context),
  • Related