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.
Signature
Section titled SignatureOpenReplay.instance.patchNetwork([ORNetworkOptions options = const ORNetworkOptions()])
OpenReplay.instance.unpatchNetwork()
patchNetwork() is idempotent. unpatchNetwork() stops capture and restores the previous overrides.
Example
Section titled ExampleOpenReplay.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.
Have questions?
Section titled Have questions?If you have any questions about this process, feel free to reach out to us on our Slack or check out our Forum.