Skip to content
This repository was archived by the owner on Apr 14, 2026. It is now read-only.

feat(native): add Android Cronet HTTP transport#217

Draft
runyaga wants to merge 1 commit intomainfrom
feat/cronet-http-transport
Draft

feat(native): add Android Cronet HTTP transport#217
runyaga wants to merge 1 commit intomainfrom
feat/cronet-http-transport

Conversation

@runyaga
Copy link
Copy Markdown
Collaborator

@runyaga runyaga commented Feb 6, 2026

Summary

  • Add CronetHttpClient for native Android HTTP via Google Play Services Cronet
  • Provides HTTP/2, HTTP/3 (QUIC), connection pooling, Brotli compression
  • Mirrors existing CupertinoHttpClient pattern with graceful DartHttpClient fallback

Changes

  • pubspec.yaml: Add cronet_http: ^1.7.0, bump http to ^1.5.0
  • CronetHttpClient: New client with .forTesting constructor, same interface as Cupertino
  • clients.dart: Add conditional export for Cronet (stub on web, real on IO)
  • create_platform_client_io.dart: Add Platform.isAndroid branch with try-catch fallback
  • Docs: Updated library and factory doc comments to list Cronet/Android
  • Tests: 33 new unit tests + 2 platform detection tests for Android

Test plan

  • flutter pub get resolves cleanly
  • dart analyze — 0 issues
  • flutter test — 72 pass, 8 skip (platform-specific)
  • Pre-commit hooks pass (format, analyze, secrets)
  • Build Android APK and verify Cronet loads on device
  • Check HTTP inspector in-app shows requests via Cronet transport

🤖 Generated with Claude Code

Add CronetHttpClient using Google Play Services Cronet for native
Android HTTP with HTTP/2, HTTP/3 (QUIC), connection pooling, and
Brotli compression. Mirrors the existing CupertinoHttpClient pattern
with graceful fallback to DartHttpClient if Cronet is unavailable.

- Add cronet_http ^1.7.0 dependency, bump http to ^1.5.0
- Create CronetHttpClient with .forTesting constructor
- Wire Platform.isAndroid in createPlatformClient factory
- Add 33 unit tests mirroring Cupertino test suite
- Update platform detection tests with Android cases
@runyaga runyaga self-assigned this Feb 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant