Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for "no_default_http_client" #1068

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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