Skip to content

Commit

Permalink
Add documentation for "no_default_http_client" (#1068)
Browse files Browse the repository at this point in the history
  • Loading branch information
brianquinlan authored Dec 4, 2023
1 parent d8983fa commit 7c05dde
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pkgs/http/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,17 @@ In Flutter, you can use a one of many
If you depend on code that uses top-level functions (e.g. `http.post`) or
calls the [`Client()`][clientconstructor] constructor, then you can use
[`runWithClient`](runwithclient) to ensure that the correct
[`Client`][client] is used.
`Client` is used.

You can ensure that only the `Client` that you have explicitly configured is
used by defining `no_default_http_client=true` in the environment. This will
also allow the default `Client` implementation to be removed, resulting in
a reduced application size.

```terminal
$ flutter build appbundle --dart-define=no_default_http_client=true ...
$ dart compile exe --define=no_default_http_client=true ...
```

> [!TIP]
> [The Flutter HTTP example application][flutterhttpexample] demonstrates
Expand Down

0 comments on commit 7c05dde

Please sign in to comment.