I’m working on a Flutter web project hosted on GitHub Pages. Right now when people visit my site, the browser tab shows the URL format like https//myusername.github.io/my-repo-name/ but I want it to display a custom project title instead.
I already made changes to several files including my main HTML file, the web manifest, and the Flutter app configuration where I set the application name. When the page first loads, I can see my custom title appears briefly, but then it gets replaced by the repository URL again.
Has anyone else run into this issue? What am I missing to make the custom title stick permanently?
This happens because Flutter web applications dynamically update the page title during initialization. The issue is that your HTML file’s title gets overridden by Flutter’s internal title management system. You need to modify the title within your Flutter app code itself, not just the HTML file. In your main.dart file, make sure you’re setting the title property in your MaterialApp widget like this: MaterialApp(title: ‘Your Custom Title’). Also check if you have any Navigator.push operations that might be setting their own titles. The web manifest changes are good but they won’t affect the browser tab title. The brief appearance of your custom title confirms that your HTML is correct, but Flutter is taking control afterwards.
maybe try checking if any other scripts or libraries are messing with the title after your custom one is set. sometimes scripts in flutters or even browser extensions can mess things up. good luck!
Double check your index.html file in the web folder and make sure the title tag is properly set there. But more importantly, if you’re using any routing in your Flutter app, each route might be overriding the title. I had this exact problem with my project and found that I needed to explicitly set the title in every route’s AppBar or use a systematic approach with the Router delegate if you’re using declarative routing. Another thing that caught me off guard was having multiple MaterialApp widgets nested somewhere in my widget tree - each one can potentially override the title. Run a search through your codebase for any other MaterialApp instances that might not have the title property set correctly.