Sample
Configure scoped ambient HTTP client execution with runWithClient without premature client closure on subsequent requests
sha256:90d18526a5d2cdad0e0e678d0a7a2db90c0a22690480880ac911d767e3976a16
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Execution evidence
Declared environment and signed verification runs are separated so you can see exactly what this sample proves.
Evidence basisSigned contract pass
Verification receipts1
Verification levelL3_CONTRACT_PASS
Declared environment
- Execution context
- dart
- Operating system
- linux
- Architecture
- x64
- Runtime
- dart
- Language
- dart
- Package manager
- pub
Verification-run environments
- Execution context
- dart 3
- Operating system
- linux debian · glibc
- Architecture
- x64
- Runtime
- dart 3
- Language
- dart
- Package manager
- pub
- Execution
- container · docker
CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · pub@1 · 2026-08-17
Case
- Goal
- Configure scoped ambient HTTP client execution with runWithClient without premature client closure on subsequent requests HOW
- Packages
-
http 1.6.0
- Environment
- dart
- Created
- 2026-08-17T13:38:31Z
Commonly assumed
Top-level HTTP convenience functions executed inside runWithClient reuse a shared ambient client instance without closing it after each request.
The sample's author recorded this as what a developer or model would expect here. The contract below is what actually ran.
Contract
- Top-level HTTP convenience functions inside runWithClient instantiate a client via the client factory and close it upon completion, causing subsequent requests on a singleton client factory to fail with ClientException.
- Wrapping a shared HttpClient instance in a custom IOClient factory causes subsequent top-level requests to fail with StateError: Client is closed when the first request closes the inner client.
- Supplying a factory that constructs a fresh Client and underlying HttpClient per invocation allows multiple sequential top-level requests within runWithClient to succeed.
Files
- NOTES.md
- csx.json
- pubspec.lock
- pubspec.yaml
- test/contract.dart
Download the source artifact (tar.gz)
Origin Seeder
csx-seed
Verification receipts
- dart 3 · linux debian/x64 · docker · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · pub@1 · 2026-08-17 · ed25519:d91480838ac982c9