File tree 1 file changed +4
-1
lines changed 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -255,7 +255,9 @@ In Flutter, you can use a one of many
255
255
If you depend on code that uses top-level functions (e.g. ` http.post ` ) or
256
256
calls the [ ` Client() ` ] [ clientconstructor ] constructor, then you can use
257
257
[ ` runWithClient ` ] ( runwithclient ) to ensure that the correct
258
- ` Client ` is used.
258
+ ` Client ` is used. When an [ Isolate] [ isolate ] is spawned, it does not inherit
259
+ any variables from the calling Zone, so ` runWithClient ` needs to be used in
260
+ each Isolate that uses ` package:http ` .
259
261
260
262
You can ensure that only the ` Client ` that you have explicitly configured is
261
263
used by defining ` no_default_http_client=true ` in the environment. This will
@@ -283,6 +285,7 @@ $ dart compile exe --define=no_default_http_client=true ...
283
285
[ fetchclient ] : https://pub.dev/documentation/fetch_client/latest/fetch_client/FetchClient-class.html
284
286
[ flutterhttpexample ] : https://github.com/dart-lang/http/tree/master/pkgs/flutter_http_example
285
287
[ ioclient ] : https://pub.dev/documentation/http/latest/io_client/IOClient-class.html
288
+ [ isolate ] : https://dart.dev/language/concurrency#how-isolates-work
286
289
[ flutterstatemanagement ] : https://docs.flutter.dev/data-and-backend/state-mgmt/options
287
290
[ provider ] : https://pub.dev/packages/provider
288
291
[ runwithclient ] : https://pub.dev/documentation/http/latest/http/runWithClient.html
You can’t perform that action at this time.
0 commit comments