1

I have two Flutter web projects: myurl.com and business.myurl.com

I added in Icons to both files, and the business site's title now changes from the title it should be, to the URL of the page after the page loads. I went over every character looking for the difference in my html files, but I can't find any mistake. Any help would be greatly appreciated!

The problem occurs in both debug mode and when hosted online.

Here is the index.html of the business site with the problem:

<head>
  <meta charset="UTF-8">
  <meta content="IE=Edge" http-equiv="X-UA-Compatible">
  <meta name="description" content="My description here.">

  <!-- iOS meta tags & icons -->
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-title" content="My Title">
  <link rel="apple-touch-icon" href="favicon.ico">

  <!-- Favicon -->
  <link rel="icon" type="image/ico" href="favicon.ico"/>

  <title>My Title</title>
 
  <link rel="manifest" href="manifest.json">
</head>

I should also note right before this error I accidently deleted my projects web folder (instead of a Icon) and I restored it from the recycle bin, and everything seems to be the same. flutter doctor shows no issues found.

EDIT: When I navigate from the home page it switches the page title to what the title is should be, if I pop back home the title is still correct. Just the first initial load of the page shows the URL as the title, until some navigation happens

August Kimo
  • 1,503
  • 8
  • 17
  • This [post](https://stackoverflow.com/questions/59220989/how-can-you-set-title-and-icon-for-a-flutter-web-app/59246487) might have some info. Especially the highest voted answer specifically for setting the title. – Abhilash Chandran Nov 03 '20 at 09:14
  • @AbhilashChandran thanks but the issue wasn't setting the title, the issue was a bug where the set title was changing to the url after the page fully loaded (it would change back to the title after a navigation occurred). – August Kimo Nov 03 '20 at 15:13

1 Answers1

0

After hours of trying, I couldn't find any good reason for this behavior and I'm going to guess it is a bug with Flutter web.

Anyways, here's a workaround fix to set the title again once it changes to the URL: (import 'package:flutter/services.dart';)

SystemChrome.setApplicationSwitcherDescription(ApplicationSwitcherDescription(
      label: 'MyTitle',
      primaryColor: Theme.of(context).primaryColor.value,
    ));
August Kimo
  • 1,503
  • 8
  • 17