getHttpAuthCredentials method
Future<List<URLCredential> >
getHttpAuthCredentials({
- required URLProtectionSpace protectionSpace,
Gets all the HTTP auth credentials saved for that protectionSpace.
Officially Supported Platforms/Implementations:
- Android WebView
- iOS WKWebView
- macOS WKWebView
- Linux WPE WebKit
Parameters - Officially Supported Platforms/Implementations:
protectionSpace: all platforms
Use the PlatformHttpAuthCredentialDatabase.isMethodSupported method to check if this method is supported at runtime.
Implementation
@override
Future<List<URLCredential>> getHttpAuthCredentials({
required URLProtectionSpace protectionSpace,
}) 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);
List<dynamic> credentialList =
await channel?.invokeMethod<List>('getHttpAuthCredentials', args) ?? [];
List<URLCredential> credentials = [];
for (Map<dynamic, dynamic> map in credentialList) {
var credential = URLCredential.fromMap(map.cast<String, dynamic>());
if (credential != null) {
credentials.add(credential);
}
}
return credentials;
}