Search code examples
flutterflutter-web

How can you set title and icon for a flutter web app?


What I'm trying to do is build a flutter web app that, when displayed in the browser, the tab shows an icon and a title (as currently it only shows the world icon and the localhost... title).

Actual Result :

Actual Result

Desired Result :

Desired Result

Edit: I can now add the title, as this is set in the main function

Widget build(BuildContext context) {
  return Scaffold(
    appBar: AppBar(
      leading: Icon(Icons.menu, color: Colors.white,),
      title: Text(_your title here_),
    )
    ...
  );
}

So, the only thing I need to edit is the favicon


Solution

  • In order to change the title to what you desire, you need to add the parameter title (Which is a String) to your MaterialApp widget.

    return MaterialApp(
      title: "MyTitle", 
      home: MyHomeWidget());