Member-only story

Capturing Network Traffic in Flutter Without Code Changes

Wing CHAN
2 min readFeb 5, 2024

--

The Issue:

Flutter apps, when using http or dio, can’t easily show their internet requests in tools like Proxyman or Charles, which many developers use to find and solve internet issues.

Solutions:

  • Code Changes: Developers might need to change their app’s code to make it work with these tools, which can be hard and risky.
  • Using Native Libraries: Another way is to use libraries made for specific devices, like cupertino_http for Apple devices, that follow the device's internet settings. But this means more work to handle different types of devices.

A Better Way

Virtual Network Interface (VIF): A good solution is to use a Virtual Network Interface (VIF). This makes a special network layer that catches all internet requests from the device, including those from Flutter apps.

Virtual Network Interface (VIF)

Given these challenges, a more robust solution involves the use of a Virtual Network Interface (VIF). VIFs create a network layer capable of capturing all network traffic from the device, regardless of individual app settings or library support. This method ensures that all network requests, including those from Flutter apps using http or dio, are captured for debugging purposes.

How to Do It with Surge:

--

--

Wing CHAN
Wing CHAN

Written by Wing CHAN

Mobile Dev 📱 iOS, Flutter

No responses yet