How to fix
The type of the right operand (‘ConfirmAction’) isn’t a subtype or a
supertype of the left operand (‘Future<ConfirmAction?>’).
this does not cause runtime errors, but it does show the recommendation in the IDE
return Dismissible(
key: UniqueKey(),
direction: DismissDirection.horizontal,
onDismissed: (direction) async {
await _asyncConfirmDialog(context).then((value) {
if (value == ConfirmAction.cancel) { //here
...
>Solution :
I don’t know what happens inside _asyncConfirmDialog, but it looks like the returned value is of type Future<Future<ConfirmAction?>>, which makes value has the type of Future<ConfirmAction?>. You need to put the await keyword to make it a ConfirmAction? (which is comparable to ConfirmAction)
await _asyncConfirmDialog(context).then((value) async { // (1) put async here
if (await value == ConfirmAction.cancel) { // (2) put await here