@@ -8,10 +8,12 @@ part of engine;
8
8
9
9
// Some parts of this file were inspired/copied from the AngularDart router.
10
10
11
- /// Ensures that [str] is prefixed with [leading] . If [str] is already prefixed,
12
- /// it'll be returned unchanged. If it's not, this function will prefix it.
11
+ /// Ensures that `str` is prefixed with `leading` .
13
12
///
14
- /// The [applyWhenEmpty] flag controls whether this function should prefix [str]
13
+ /// If `str` is already prefixed, it'll be returned unchanged. If it's not,
14
+ /// this function will prefix it.
15
+ ///
16
+ /// The `applyWhenEmpty` flag controls whether this function should prefix `str`
15
17
/// or not when it's an empty string.
16
18
///
17
19
/// ```dart
@@ -27,9 +29,10 @@ String ensureLeading(String str, String leading, {bool applyWhenEmpty = true}) {
27
29
return str.startsWith (leading) ? str : '$leading $str ' ;
28
30
}
29
31
30
- /// `LocationStrategy` is responsible for representing and reading route state
31
- /// from the browser's URL. At the moment, only one strategy is implemented:
32
- /// [HashLocationStrategy] .
32
+ /// [LocationStrategy] is responsible for representing and reading route state
33
+ /// from the browser's URL.
34
+ ///
35
+ /// At the moment, only one strategy is implemented: [HashLocationStrategy] .
33
36
///
34
37
/// This is used by [BrowserHistory] to interact with browser history APIs.
35
38
abstract class LocationStrategy {
@@ -61,14 +64,14 @@ abstract class LocationStrategy {
61
64
/// to represent its state.
62
65
///
63
66
/// In order to use this [LocationStrategy] for an app, it needs to be set in
64
- /// [ui.window.webOnlyLocationStrategy ] :
67
+ /// [ui.window.locationStrategy ] :
65
68
///
66
69
/// ```dart
67
70
/// import 'package:flutter_web/material.dart';
68
71
/// import 'package:flutter_web/ui.dart' as ui;
69
72
///
70
73
/// void main() {
71
- /// ui.window.webOnlyLocationStrategy = const ui.HashLocationStrategy();
74
+ /// ui.window.locationStrategy = const ui.HashLocationStrategy();
72
75
/// runApp(MyApp());
73
76
/// }
74
77
/// ```
@@ -124,8 +127,10 @@ class HashLocationStrategy extends LocationStrategy {
124
127
return _waitForPopState ();
125
128
}
126
129
127
- /// Waits until the next popstate event is fired. This is useful for example
128
- /// to wait until the browser has handled the `history.back` transition.
130
+ /// Waits until the next popstate event is fired.
131
+ ///
132
+ /// This is useful for example to wait until the browser has handled the
133
+ /// `history.back` transition.
129
134
Future <void > _waitForPopState () {
130
135
final Completer <void > completer = Completer <void >();
131
136
ui.VoidCallback unsubscribe;
@@ -137,10 +142,10 @@ class HashLocationStrategy extends LocationStrategy {
137
142
}
138
143
}
139
144
140
- /// ` PlatformLocation` encapsulates all calls to DOM apis, which allows the
145
+ /// [ PlatformLocation] encapsulates all calls to DOM apis, which allows the
141
146
/// [LocationStrategy] classes to be platform agnostic and testable.
142
147
///
143
- /// The ` PlatformLocation` class is used directly by all implementations of
148
+ /// The [ PlatformLocation] class is used directly by all implementations of
144
149
/// [LocationStrategy] when they need to interact with the DOM apis like
145
150
/// pushState, popState, etc...
146
151
abstract class PlatformLocation {
0 commit comments