Skip to content

Edoardo Vignati 👨🏻‍💻

› Always looking for awesome things

Menu
  • Studies
  • Publications
  • Skills
  • Portfolio
  • Projects
  • Career
  • Blog
  • 🇮🇹 Servizi
Menu

How to open a page in Facebook app in Android with Flutter (deep link)

Posted on 29/08/202126/06/2022 by Edoardo

Maybe, if you are here, it means that you already tried to launch the Facebook URL of a page failing because the browser is launched instead of the native app.

Well, to open the Facebook app on a specific page it’s quite simple if you know the correct way.

First of all you can use the launchUrlString() method of the url_launcher() package (launch() is deprecated since v6.1.0).

The URL must be in this form:

  • “fb://page/page_id” where page_id is the numeric id of the Facebook page
  • “fb://profile/profile_id” where profile_id is the numeric id of the Facebook profile

To discover the id (only for pages!) you can simply use the following script:

So the method call should be something like this:

launchUrlString("fb://page/510641739115082"); // For pages
launchUrlString("fb://profile/........"); // For profiles
String pageid = "510641739115082";
Padding(
  padding: EdgeInsets.only(right: 20.0),
  child: IconButton(
    icon: Icon(FontAwesomeIcons.facebook, color: Theme
        .of(context)
        .buttonColor, size: 40.0),
    onPressed: () {
    		String facebookApp = "fb://page/${pageid}";
            canLaunchUrlString(facebookApp).then((canLaunch) {
              if (canLaunch) {
                launchUrlString(facebookApp);
              } else {
               	// Do something else
              }
            });
         });
    },
  ),
)

…and the app will be launched 🙂

Happy coding!


Buy Me A Coffee


This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© 2025 Edoardo Vignati 👨🏻‍💻 | Powered by Minimalist Blog WordPress Theme