sur950 / any_link_preview

A flutter Plugin/Package to show the preview of any web link that starts with HTTP/HTTPS. Mostly useful for application that had chat.
MIT License
70 stars 70 forks source link

A bug in any_link_preview package #40

Closed mycar98765 closed 1 year ago

mycar98765 commented 1 year ago

I found a bug in the any_link_preview package. I asked a question and got answer in Stack Overflow. This and this comment are about the bug: https://stackoverflow.com/questions/74471700/how-to-make-a-chat-bubble-like-whatsapps-chat-bubble-in-flutter#comment131464378_74471788 https://stackoverflow.com/questions/74471700/how-to-make-a-chat-bubble-like-whatsapps-chat-bubble-in-flutter#comment131464458_74471788

Ok, I added placeholders. Only, if something like the 2nd and 4th image appears in my question, which contains words that are not URLs, no results are returned

There seems to be a problem with the package. I have no idea what's next.

Second and fourth pictures:

Second picture

Forth picture

I really hope this bug can be fixed. If this bug is fixed, this package will really be 100% usable in chat. Thanks in advance!

sgbasaraner commented 1 year ago

Can you show some of your code? It's confusing and bad UX to jump back and forth between SO discussions to understand the issue. I read them and now I'm unsure if the package has a bug or your implementation has one.

mycar98765 commented 1 year ago

Hi @sgbasaraner ok I will share my code

mycar98765 commented 1 year ago

My code:

AnyLinkPreview(
  link: message,
),
mycar98765 commented 1 year ago

When the message contains words that are not URLs, no results are returned.

mycar98765 commented 1 year ago

Only returns results if the message is a URL

sgbasaraner commented 1 year ago

AFAIK the library doesn't do the URL detection for you. You should iterate over the message, and if you come across a URL, pass that to the library.

mycar98765 commented 1 year ago

@sgbasaraner I don't quite get it. Can you share some code samples?

sur950 commented 1 year ago

Thanks for helping the community @sgbasaraner

My code:

AnyLinkPreview(
  link: message,
),

@mycar98765 This library expects a valid URL in your message variable. So you will need to identify the URL from your text and pass it on to the library instead of passing everything.

sur950 commented 1 year ago

As this is more of an implementation issue, I would suggest asking questions in Stack Overflow forums.