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
224 stars 81 forks source link

Cannot compile on Web #124

Closed TomaszCz closed 6 months ago

TomaszCz commented 6 months ago

Describe the bug

I want to use this lovely package to handle deep links on desktop such us windows / macos. I managed to make it working, but unfortunately during further testing I discovered that with this package I broke the ability to compile my app for web. It is likely due to win32 package.

To recreate my issue, open your example folder, add web support flutter create --platforms=web .

And try to compile, you will see the issue image

I would love to use this package, but i need to support web as well. do you have any advice ? :)

ps I will try to conditionally include win32 into compilation based on platform, have not done it but it should be possible.

llfbandit commented 6 months ago

This has nothing related to this package. Somewhere in your app you have a reference to win32 package but not from here. You can directly check dependencies from pub.dev to confirm.

TomaszCz commented 6 months ago

hey! I appreciate fast reply. I am not using win32, in my project and it compiled on web fine. After i added your package with the given instruction image The web compilation started to break. After investigation, it is win32 package used for registry edit. ( scheme registration ).

Please notice I am trying to check your example ( from this repo ) to check if it would work on web unchanged, and unfortunately it doesn't. image

llfbandit commented 6 months ago

Oh ok, look closely here: https://github.com/llfbandit/app_links/blob/0ba03114bde67dc2ee5db484a83bfced82cef5a5/example/lib/main.dart#L156-L162

registerProtocolHandler won't be called unless you're on windows platform. You can also use conditionnal import for example.