Skip to content

Commit 31055b3

Browse files
author
Tony Sansone
committed
Updated deferred lang on libraries
1 parent e72b9e2 commit 31055b3

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

src/language/libraries.md

+9-18
Original file line numberDiff line numberDiff line change
@@ -92,34 +92,25 @@ import 'package:lib2/lib2.dart' hide foo;
9292
<a id="deferred-loading"></a>
9393
#### Lazily loading a library
9494

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.
9997

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.
101101
* To perform A/B testing—trying out
102-
alternative implementations of an algorithm, for example.
102+
alternative implementations of an algorithm.
103103
* To load rarely used functionality, such as optional screens and dialogs.
104104

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`.
115106

116107
<?code-excerpt "misc/lib/language_tour/libraries/greeter.dart (import)" replace="/hello\.dart/package:greetings\/$&/g"?>
117108
```dart
118109
import 'package:greetings/hello.dart' deferred as hello;
119110
```
120111

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.
123114

124115
<?code-excerpt "misc/lib/language_tour/libraries/greeter.dart (loadLibrary)"?>
125116
```dart

0 commit comments

Comments
 (0)