uni_links
uni_links copied to clipboard
getInitialLink and getInitialUri will return null on some devices
I have an app and until now two users reported that they aren't able to login (My app uses uni_links to get the response from OAuth). after sending these users a custom build to debug the issue via sentry, I found that they were getting the getInitialLink as null. In the majority of the userbase the app and uni_links works just fine (~10k users). What I could find that these users share is that they are on Android and that the link was being called from chrome. I wasn't able to find a way to reproduce the bug properly in my setup. All that I could find out until now is that they use other apps that uses deeplinks (non flutter apps) and they work properly. the pattern that I'm using right now for my app is luzinha://login?code=########################
I'll investigate. Thanks for reporting.
Thanks. I will continue to try to find out what could be causing this and report if I get any new info.
For me getInitialLink and getInitialUri are always null on ios, even if same code returns correct values for android.
I was able to access the values using streams as a workaround, see the documentation at https://pub.dev/packages/uni_links#-readme-tab-:
import 'dart:async';
import 'dart:io';
import 'package:uni_links/uni_links.dart';
// ...
StreamSubscription _sub;
Future<Null> initUniLinks() async {
// ... check initialLink
// Attach a listener to the stream
_sub = getLinksStream().listen((String link) {
// Parse the link and warn the user, if it is not correct
}, onError: (err) {
// Handle exception by warning the user their action did not succeed
});
// NOTE: Don't forget to call _sub.cancel() in dispose()
}
// ...