From 2fb39519e41b2611ef790d25ac882a7fa207ce3b Mon Sep 17 00:00:00 2001 From: Brian Quinlan Date: Mon, 4 Dec 2023 13:59:17 -0800 Subject: [PATCH] Add documentation for "no_default_http_client" --- pkgs/http/README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkgs/http/README.md b/pkgs/http/README.md index 689e8fbe4e..8ce106d43e 100644 --- a/pkgs/http/README.md +++ b/pkgs/http/README.md @@ -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