-1
// FirstScreen

  final result = await  Get.to(SecondScreen());

//SecondScreen

//First button onTap
Get.back(result: 10)

//second buton onTap

 Get.back(result: true);

How can I identify the result is bool or int type when back to the second screen to the first screen.

Akif
  • 7,098
  • 7
  • 27
  • 53
Alpit Panchal
  • 709
  • 1
  • 7
  • 25

1 Answers1

2

You can check it with is like this:

if (result is int) {
  print("result is int");
}
else if (result is bool) {
  print("result is bool");
}
Akif
  • 7,098
  • 7
  • 27
  • 53