File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -498,21 +498,19 @@ class _FinampState extends State<Finamp> with WindowListener {
498498 @override
499499 void initState () {
500500 super .initState ();
501- // Subscribe to all events (initial link and further)
502- _uriLinkSubscription = AppLinks ().uriLinkStream.listen ((uri) async {
503- linkHandlingLogger.info ("Received link: $uri " );
504- int attempts = 0 ;
505- do {
501+
502+ SchedulerBinding .instance.addPostFrameCallback ((_) {
503+ _uriLinkSubscription = AppLinks ().uriLinkStream.listen ((uri) async {
504+ linkHandlingLogger.info ("Received link: $uri " );
506505 var context = GlobalSnackbar .materialAppNavigatorKey.currentContext;
507506 if (context != null ) {
508507 if (uri.host == "internal" ) {
509508 await Navigator .of (context).pushNamed (uri.path);
510509 }
511- break ;
510+ } else {
511+ linkHandlingLogger.warning ("No context available to handle link" );
512512 }
513- // Wait for the context to be available
514- await Future <void >.delayed (const Duration (milliseconds: 250 ));
515- } while (++ attempts < 10 );
513+ });
516514 });
517515
518516 // If the app is running on desktop, we add a listener to the window manager
You can’t perform that action at this time.
0 commit comments