setHttpAuthCredential method
Future<void>
setHttpAuthCredential({
- required URLProtectionSpace protectionSpace,
- required URLCredential credential,
Saves an HTTP auth credential
for that protectionSpace
.
Officially Supported Platforms/Implementations:
- Android native WebView
- iOS (Official API - URLCredentialStorage.set)
- MacOS (Official API - URLCredentialStorage.set)
Implementation
@override
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);
}