avioli / uni_links

Flutter plugin for accepting incoming links.
BSD 2-Clause "Simplified" License
563 stars 303 forks source link

Flutter Web #51

Closed joeblew99 closed 3 years ago

joeblew99 commented 4 years ago

We are using flutter web, desktop and mobile.

Has anyone gotten this to work with Flutter web ?

Faiyyaz commented 4 years ago

Even I am planning to develop for web and currently I am using this in android & iOS. So please help me

JohnGalt1717 commented 4 years ago

First step I would think is to split this for platform interface. Once that's done, adding web would be straight forward.

ManuAppDev commented 4 years ago

Hi JohnGalt1717, is there a workaround you can think of to get it to work on flutter for web for now?

JohnGalt1717 commented 4 years ago

@ManuAppDev I guess you could write it against the old way of doing plugins and then have to rearch it later. The code is relatively straight forward to write. Just have to parse the window.location in dart:html and then pull out the queryParams (the rest will automatically work already as long as you pass the settings into your routes) and make them parameters. It gets more complex to handle cases where parameters are being passed in the path but those should already be handled in code.

You could do this right now by creating your own package that does a conditional export with a dummy no-op for everything else and just has one static that is called in your main(). The web version would take the navigator and navigate, the mobile etc. one would just no-op.

But for this project to work going forward with all of the new platforms it needs to use PlatformInterface properly.

ManuAppDev commented 4 years ago

The problem i'm facing is that this method getUriLinksStream().listen((Uri uri) {} is not working on flutter for web. Not sure why but it's not picking up if a link is returned by an external event. In my case my app opens up a URL to Stripe and this is returning a url which is then picked up by my application and processing is resumed.

JohnGalt1717 commented 4 years ago

This won't project has no knowledge of the web at all. That will only be raised on ios and android. To make it work the plugin has to be extended to web, which first requires that it be refactored to use the new IPlatform functionality.

So if you're trying to use this on web as it currently is, it won't work at all and has no ability to do so. So you'll either have to do it yourself as outlined or get the attention of the maintainers to refactor to IPlatfomr and then I'll happily add the web code for it once that's done.

AndiDog commented 4 years ago

For me, a call to await getInitialUri() is hanging when used with Flutter Web, while the package works great with iOS. Had to add if (!kIsWeb) initialUri = await getInitialUri(); to exclude web.

EightRice commented 4 years ago

ok, so does this mean there's no way to automatically retrieve oauth2 token in Flutter web ?

hacker1024 commented 3 years ago

I've implemented this in #93.

ssbateni commented 3 years ago

I've implemented this in #93.

How can we use this in our project?