setHttpAuthCredential method

Future<void> setHttpAuthCredential({
  1. required URLProtectionSpace protectionSpace,
  2. required URLCredential credential,
})

Saves an HTTP auth credential for that protectionSpace.

Implementation

Future<void> setHttpAuthCredential(
    {required URLProtectionSpace protectionSpace,
    required URLCredential credential}) async {
  Map<String, dynamic> args = <String, dynamic>{};
  args.putIfAbsent("host", () => protectionSpace.host);
  args.putIfAbsent("protocol", () => protectionSpace.protocol);
  args.putIfAbsent("realm", () => protectionSpace.realm);
  args.putIfAbsent("port", () => protectionSpace.port);
  args.putIfAbsent("username", () => credential.username);
  args.putIfAbsent("password", () => credential.password);
  await _channel.invokeMethod('setHttpAuthCredential', args);
}