Open gauravmehta13 opened 1 year ago
now the problem is that you are awaiting for dynamic value not bool because Get.to return dynamic value (you may ask how! because i want to return bool), ok but lets say the page was closed by back button or you just typed Get.back() and forgot to return anything this mean the return value is not bool its (void) which is type of dynamic, so the error is not related to GetX its type error
Then how come it works with Flutter Navigator @EmadBeltaje Also there is a way to specify the type that we are planning to return but that also doesnt work.
final bool? completed = await Get.to<bool>(() => MetricPage());
Moreover if the page was closed by back button or you just typed Get.back() and forgot to return anything, Then it returns null and not void.
Then how come it works with Flutter Navigator @EmadBeltaje Also there is a way to specify the type that we are planning to return but that also doesnt work.
final bool? completed = await Get.to<bool>(() => MetricPage());
Moreover if the page was closed by back button or you just typed Get.back() and forgot to return anything, Then it returns null and not void.
Is there a way to specify the return type: Sadly No in flutter navigator you can specify the type using generic but in Getx the safe way to deal with it is
final result = await Get.to(() => MyPage());
// you can also check for the type here
if(result != null){
// run any action here..
}
I have a fix for that, I will send asap
Describe the bug The Get.to works fine when calling the class but if we await the response in a particular type then it doesnt
Reproduction code
example:
This doesn't work
But this works
To Reproduce Just call the navigation code like above it will throw this error
Flutter Version: 3.13
Getx Version: get: ^5.0.0-release-candidate-5