Skip to content

feat(network): add configureDriver() plugin hook for Dio access#35

Merged
anilcancakir merged 2 commits intomasterfrom
feat/network-driver-plugin-hook
Apr 5, 2026
Merged

feat(network): add configureDriver() plugin hook for Dio access#35
anilcancakir merged 2 commits intomasterfrom
feat/network-driver-plugin-hook

Conversation

@anilcancakir
Copy link
Copy Markdown
Contributor

Closes #32

Summary

  • Add DioNetworkDriver.configureDriver(void Function(Dio) configurator) for raw Dio instance access
  • Enables SDK integrations: sentry_dio, certificate pinning, custom adapters
  • Configurator callback pattern — Dio stays driver-owned, no public getter
  • Not on NetworkDriver contract — Dio-specific method only

Test plan

  • configureDriver() applies configurator to Dio instance
  • Multiple configurators can be applied sequentially
  • Full test suite: 696 tests pass
  • dart analyze: zero warnings

Copilot AI review requested due to automatic review settings April 5, 2026 18:53
@sentry
Copy link
Copy Markdown

sentry bot commented Apr 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Dio-specific plugin hook to the Magic network stack so SDKs/adapters can configure the underlying Dio instance without exposing it via a public getter.

Changes:

  • Add DioNetworkDriver.configureDriver(void Function(Dio) configurator) to allow direct, driver-owned Dio configuration.
  • Add unit tests for configureDriver() and sequential configurator usage.
  • Document the new hook in framework references + basics docs, and add a CHANGELOG entry.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
lib/src/network/drivers/dio_network_driver.dart Introduces configureDriver() hook to apply a callback to the internal Dio instance.
test/network/network_test.dart Adds tests covering configurator invocation and multiple configurators.
skills/magic-framework/references/http-network.md Documents the Dio driver plugin hook and how to access it.
doc/basics/http-client.md Adds end-user docs for the new driver plugin hook usage.
CHANGELOG.md Adds an Unreleased feature entry for the new hook.

anilcancakir added a commit that referenced this pull request Apr 5, 2026
)

Tests now verify interceptor count changes on the driver-owned Dio
instance instead of only asserting callbacks were invoked. Ensures
configurator receives the actual Dio instance, not a fresh one.
Enables SDK integrations (sentry_dio, cert pinning) that need raw Dio
instance access. Configurator callback pattern keeps Dio conceptually
owned by the driver while allowing one-time setup.
)

Tests now verify interceptor count changes on the driver-owned Dio
instance instead of only asserting callbacks were invoked. Ensures
configurator receives the actual Dio instance, not a fresh one.
@anilcancakir anilcancakir force-pushed the feat/network-driver-plugin-hook branch from 0e7840a to 2a1e074 Compare April 5, 2026 19:08
@anilcancakir anilcancakir merged commit 0cba3ef into master Apr 5, 2026
2 checks passed
@anilcancakir anilcancakir mentioned this pull request Apr 5, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add plugin hook for network driver customization

2 participants