Await not working
Hi @droibit @petermnt @davidmigloz @Gurkengewuerz
When utilizing custom tabs with a URL, it doesn't wait until it's finished rather than executing next methods.
await launchUrl( Uri.parse(url), prefersDeepLink: true, customTabsOptions: CustomTabsOptions( colorSchemes: CustomTabsColorSchemes.defaults( toolbarColor: Colors.white, ), shareState: CustomTabsShareState.off, ), safariVCOptions: const SafariViewControllerOptions( preferredBarTintColor: Colors.white, preferredControlTintColor: Colors.white, ), ); await storeTokens();
storeTokens()async{
await storevalues with SharedPrefrences
}
After calling launchurl, the storeTokens function is called, but must wait for it to finish.
@droibit have a look at this issue
This is the intended behavior - launchUrl waits until the Custom Tab is launched but doesn't wait for it to close.
While I could implement a "wait until closed" feature on iOS,
I haven't found a reliable solution for Android, especially with Custom Tabs that support Picture-in-Picture mode.
I'm considering adding this functionality if I can implement consistent behavior across platforms, but don't have a timeline yet.