Flutter SDK - patchNetwork method

Details about the patchNetwork method from OpenReplay's Flutter SDK

Flutter SDK ⁠-⁠ patchNetwork method

Starts capturing dart:io HTTP traffic. This installs an HttpOverrides, chaining to any already present, so it covers HttpClient directly as well as package:http’s IOClient and Dio’s default adapter.

OpenReplay.instance.patchNetwork([ORNetworkOptions options = const ORNetworkOptions()])
OpenReplay.instance.unpatchNetwork()

patchNetwork() is idempotent. unpatchNetwork() stops capture and restores the previous overrides.

OpenReplay.instance.patchNetwork(ORNetworkOptions(
  capturePayload: true,
  sanitizer: (record) {
    record.url = record.url.replaceAll(RegExp(r'token=[^&]+'), 'token=***');
    return record; // return null to drop the call entirely
  },
));

See network options for every field of ORNetworkOptions.

If you have any questions about this process, feel free to reach out to us on our Slack .