diff --git a/lib/web_ui/lib/src/engine/browser_location.dart b/lib/web_ui/lib/src/engine/browser_location.dart index bffbfee2c12a9..a0f5ff8997a10 100644 --- a/lib/web_ui/lib/src/engine/browser_location.dart +++ b/lib/web_ui/lib/src/engine/browser_location.dart @@ -8,10 +8,12 @@ part of engine; // Some parts of this file were inspired/copied from the AngularDart router. -/// Ensures that [str] is prefixed with [leading]. If [str] is already prefixed, -/// it'll be returned unchanged. If it's not, this function will prefix it. +/// Ensures that `str` is prefixed with `leading`. /// -/// The [applyWhenEmpty] flag controls whether this function should prefix [str] +/// If `str` is already prefixed, it'll be returned unchanged. If it's not, +/// this function will prefix it. +/// +/// The `applyWhenEmpty` flag controls whether this function should prefix `str` /// or not when it's an empty string. /// /// ```dart @@ -27,9 +29,10 @@ String ensureLeading(String str, String leading, {bool applyWhenEmpty = true}) { return str.startsWith(leading) ? str : '$leading$str'; } -/// `LocationStrategy` is responsible for representing and reading route state -/// from the browser's URL. At the moment, only one strategy is implemented: -/// [HashLocationStrategy]. +/// [LocationStrategy] is responsible for representing and reading route state +/// from the browser's URL. +/// +/// At the moment, only one strategy is implemented: [HashLocationStrategy]. /// /// This is used by [BrowserHistory] to interact with browser history APIs. abstract class LocationStrategy { @@ -61,14 +64,14 @@ abstract class LocationStrategy { /// to represent its state. /// /// In order to use this [LocationStrategy] for an app, it needs to be set in -/// [ui.window.webOnlyLocationStrategy]: +/// [ui.window.locationStrategy]: /// /// ```dart /// import 'package:flutter_web/material.dart'; /// import 'package:flutter_web/ui.dart' as ui; /// /// void main() { -/// ui.window.webOnlyLocationStrategy = const ui.HashLocationStrategy(); +/// ui.window.locationStrategy = const ui.HashLocationStrategy(); /// runApp(MyApp()); /// } /// ``` @@ -124,8 +127,10 @@ class HashLocationStrategy extends LocationStrategy { return _waitForPopState(); } - /// Waits until the next popstate event is fired. This is useful for example - /// to wait until the browser has handled the `history.back` transition. + /// Waits until the next popstate event is fired. + /// + /// This is useful for example to wait until the browser has handled the + /// `history.back` transition. Future _waitForPopState() { final Completer completer = Completer(); ui.VoidCallback unsubscribe; @@ -137,10 +142,10 @@ class HashLocationStrategy extends LocationStrategy { } } -/// `PlatformLocation` encapsulates all calls to DOM apis, which allows the +/// [PlatformLocation] encapsulates all calls to DOM apis, which allows the /// [LocationStrategy] classes to be platform agnostic and testable. /// -/// The `PlatformLocation` class is used directly by all implementations of +/// The [PlatformLocation] class is used directly by all implementations of /// [LocationStrategy] when they need to interact with the DOM apis like /// pushState, popState, etc... abstract class PlatformLocation { diff --git a/lib/web_ui/lib/src/engine/window.dart b/lib/web_ui/lib/src/engine/window.dart index 8a995f0ca03ee..0a1a86c5058f8 100644 --- a/lib/web_ui/lib/src/engine/window.dart +++ b/lib/web_ui/lib/src/engine/window.dart @@ -81,12 +81,6 @@ class EngineWindow extends ui.Window { _browserHistory.locationStrategy = strategy; } - /// This setter is used by [WebNavigatorObserver] to update the url to - /// reflect the [Navigator]'s current route name. - set webOnlyRouteName(String routeName) { - _browserHistory.setRouteName(routeName); - } - @override void sendPlatformMessage( String name,