0
Navigator.popUntil(context, (route) => route.isFirst);

I try this back transition this. I wanna get bool argument at the same time.

class Position {
  Position(bool isFirst, bool value);
}

Navigator.popUntil(context, ((route) {
  return Position(route.isFirst, true);
}));

I tried this, but I got error.

The return type 'Position' isn't a 'bool', as required by the closure's context.

How can I do?

Uta
  • 13
  • 4

2 Answers2

0

Please do check the argument in position constructor. I could see two data type mentioned in the place of variable name.

class Position {
  Position(bool isFirst, bool bool);
}

Change the above one to like below:

class Position {
  Position(bool isFirst, bool value1);
}
  • sorry name mistaking.But I got error. Please check error message in my question – Uta Jun 30 '22 at 07:27
0

Please follow this link : Flutter - Pass Data Back with .popUntil

it should be boolean value. for values you can write :

Navigator.popUntil(context, ((route) {
 (route.settings.arguments as Map)['result'] = 'data';
   return true;
}));
Hardik Mehta
  • 2,195
  • 1
  • 11
  • 14