Search code examples
flutterurlfavicon

How can i get the favicon url from a website url using flutter


assume someone gives me the URL of google. now I need to find the favicon URL of Google.


Solution

  • For the most ways you can just add favicon.ico to the sites urls, for example https://google.com/favicon.ico, but sometimes it won't work, so you can use favicon library:

    var iconUrl = await FaviconFinder.getBest('https://stackoverflow.com/');
    print(iconUrl!.url); // http://stackoverflow.com/favicon.ico