createHttpClient method
Returns a new HttpClient using the given context
.
When this override is installed, this function overrides the behavior of
new HttpClient
.
Implementation
@override
HttpClient createHttpClient(SecurityContext? context) {
// Use the custom client creation function if provided,
// otherwise delegate to the superclass implementation.
final client =
createHttpClientFn != null
? createHttpClientFn!(context)
: super.createHttpClient(context);
// Wrap the client with StethoHttpClient only on Android.
if (Platform.isAndroid) {
return StethoHttpClient(client);
}
// Return the client as-is for other platforms.
return client;
}