llfbandit / app_links

Android App Links, Deep Links, iOs Universal Links and Custom URL schemes handler for Flutter.
https://pub.dev/packages/app_links
Apache License 2.0
176 stars 68 forks source link

[Feature] A single stream for all links #30

Closed cachapa closed 1 year ago

cachapa commented 1 year ago

Generally when I'm implementing app links, I'm interested in all incoming messages regardless of app state.

It would be nice to have a single stream that combines both initial and ongoing links to make it easier to implement this (I believe) common use case.

Here's my implementation as an extension:

extension AppLinkX on AppLinks {
  Stream<Uri> get allLinks async* {
    final initial = await getInitialAppLink();
    if (initial != null) yield initial;
    yield* uriLinkStream;
  }
}
llfbandit commented 1 year ago

Thanks the contribution. It will be added in the next release (soon).