Skip to content

Commit 7c05dde

Browse files
authored
Add documentation for "no_default_http_client" (#1068)
1 parent d8983fa commit 7c05dde

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

pkgs/http/README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,17 @@ In Flutter, you can use a one of many
255255
If you depend on code that uses top-level functions (e.g. `http.post`) or
256256
calls the [`Client()`][clientconstructor] constructor, then you can use
257257
[`runWithClient`](runwithclient) to ensure that the correct
258-
[`Client`][client] is used.
258+
`Client` is used.
259+
260+
You can ensure that only the `Client` that you have explicitly configured is
261+
used by defining `no_default_http_client=true` in the environment. This will
262+
also allow the default `Client` implementation to be removed, resulting in
263+
a reduced application size.
264+
265+
```terminal
266+
$ flutter build appbundle --dart-define=no_default_http_client=true ...
267+
$ dart compile exe --define=no_default_http_client=true ...
268+
```
259269

260270
> [!TIP]
261271
> [The Flutter HTTP example application][flutterhttpexample] demonstrates

0 commit comments

Comments
 (0)