@@ -328,7 +328,7 @@ class WidgetsApp extends StatefulWidget {
328328 this .home,
329329 Map <String , WidgetBuilder > this .routes = const < String , WidgetBuilder > {},
330330 this .builder,
331- this .title = '' ,
331+ this .title,
332332 this .onGenerateTitle,
333333 this .textStyle,
334334 required this .color,
@@ -425,7 +425,7 @@ class WidgetsApp extends StatefulWidget {
425425 this .routerConfig,
426426 this .backButtonDispatcher,
427427 this .builder,
428- this .title = '' ,
428+ this .title,
429429 this .onGenerateTitle,
430430 this .onNavigationNotification,
431431 this .textStyle,
@@ -828,7 +828,7 @@ class WidgetsApp extends StatefulWidget {
828828 ///
829829 /// To provide a localized title instead, use [onGenerateTitle] .
830830 /// {@endtemplate}
831- final String title;
831+ final String ? title;
832832
833833 /// {@template flutter.widgets.widgetsApp.onGenerateTitle}
834834 /// If non-null this callback function is called to produce the app's
@@ -1771,7 +1771,7 @@ class _WidgetsAppState extends State<WidgetsApp> with WidgetsBindingObserver {
17711771 return true ;
17721772 }());
17731773
1774- final Widget title;
1774+ final Widget ? title;
17751775 if (widget.onGenerateTitle != null ) {
17761776 title = Builder (
17771777 // This Builder exists to provide a context below the Localizations widget.
@@ -1786,9 +1786,14 @@ class _WidgetsAppState extends State<WidgetsApp> with WidgetsBindingObserver {
17861786 );
17871787 },
17881788 );
1789+ } else if (widget.title == null && kIsWeb) {
1790+ // Updating the <title /> element in the DOM is problematic in embedded
1791+ // and multiview modes as title should be managed by host apps.
1792+ // Refer to https://github.com/flutter/flutter/pull/152003 for more info.
1793+ title = null ;
17891794 } else {
17901795 title = Title (
1791- title: widget.title,
1796+ title: widget.title ?? '' ,
17921797 color: widget.color.withOpacity (1.0 ),
17931798 child: result,
17941799 );
@@ -1823,7 +1828,7 @@ class _WidgetsAppState extends State<WidgetsApp> with WidgetsBindingObserver {
18231828 child: Localizations (
18241829 locale: appLocale,
18251830 delegates: _localizationsDelegates.toList (),
1826- child: title,
1831+ child: title ?? result ,
18271832 ),
18281833 ),
18291834 ),
0 commit comments