getHttpAuthCredentials method
Future<List<URLCredential> >
getHttpAuthCredentials({
- required URLProtectionSpace protectionSpace,
Gets all the HTTP auth credentials saved for that protectionSpace
.
Officially Supported Platforms/Implementations:
- Android native WebView
- iOS
- MacOS
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;
}