@@ -92,34 +92,25 @@ import 'package:lib2/lib2.dart' hide foo;
92
92
<a id =" deferred-loading " ></a >
93
93
#### Lazily loading a library
94
94
95
- _ Deferred loading_ (also called _ lazy loading_ )
96
- allows a web app to load a library on demand,
97
- if and when the library is needed.
98
- Here are some cases when you might use deferred loading:
95
+ * Deferred loading* (also called * lazy loading* ) allows
96
+ web and Flutter Android apps to load a library on demand.
99
97
100
- * To reduce a web app's initial startup time.
98
+ Use deferred loading in the following use cases:
99
+
100
+ * To reduce an Android or web app's initial startup time.
101
101
* To perform A/B testing—trying out
102
- alternative implementations of an algorithm, for example .
102
+ alternative implementations of an algorithm.
103
103
* To load rarely used functionality, such as optional screens and dialogs.
104
104
105
- {{site.alert.warn}}
106
- ** Only ` dart compile js ` supports deferred loading.**
107
- Flutter and the Dart VM don't support deferred loading.
108
- To learn more, see
109
- [ issue #33118 ] ( https://github.com/dart-lang/sdk/issues/33118 ) and
110
- [ issue #27776 .] ( https://github.com/dart-lang/sdk/issues/27776 )
111
- {{site.alert.end}}
112
-
113
- To lazily load a library, you must first
114
- import it using ` deferred as ` .
105
+ To lazily load a library, import it using ` deferred as ` .
115
106
116
107
<? code-excerpt "misc/lib/language_tour/libraries/greeter.dart (import)" replace="/hello\.dart/package:greetings\/$&/g"?>
117
108
``` dart
118
109
import 'package:greetings/hello.dart' deferred as hello;
119
110
```
120
111
121
- When you need the library, invoke
122
- ` loadLibrary() ` using the library's identifier.
112
+ When you need the library,
113
+ invoke ` loadLibrary() ` using the library's identifier.
123
114
124
115
<? code-excerpt "misc/lib/language_tour/libraries/greeter.dart (loadLibrary)"?>
125
116
``` dart
0 commit comments