TitleManager class
Manages page titles across routing, widgets, and facades.
Follows the singleton pattern used by MagicRouter. Computes the effective title from a priority stack (override → route → app) and optionally appends a shared suffix. Invokes an injectable callback on every change so tests can capture updates without mocking SystemChrome.
Priority (highest → lowest):
- setOverride — set from
MagicTitlewidget orsetTitlefacade call - setRouteTitle — set from GoRouter route listener
- setAppTitle — set from application bootstrap
Properties
- currentTitle → String?
-
Returns the effective title without the suffix applied.
no setter
- effectiveTitle → String
-
Returns the computed title with the suffix applied.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reapply(
) → void - Re-push the current effectiveTitle through the change callback.
-
setAppTitle(
String? appTitle) → TitleManager - Set the application-level title used as the final fallback.
-
setOverride(
String? overrideTitle) → TitleManager -
Set an explicit override title from
MagicTitleor thesetTitlefacade. -
setRouteTitle(
String? routeTitle) → TitleManager - Set the route-level title, typically sourced from a RouteDefinition.
-
setSeparator(
String separator) → TitleManager - Set the separator placed between the title and the suffix.
-
setSuffix(
String? suffix) → TitleManager - Set the global title suffix (e.g. the app name appended to page titles).
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → TitleManager
-
Access the global TitleManager instance.
no setter