getAllAuthCredentials method

Gets a map list of all HTTP auth credentials saved. Each map contains the key protectionSpace of type URLProtectionSpace and the key credentials of type List<URLCredential> that contains all the HTTP auth credentials saved for that protectionSpace.

Implementation

Future<List<URLProtectionSpaceHttpAuthCredentials>>
    getAllAuthCredentials() async {
  Map<String, dynamic> args = <String, dynamic>{};
  List<dynamic> allCredentials =
      await _channel.invokeMethod('getAllAuthCredentials', args);

  List<URLProtectionSpaceHttpAuthCredentials> result = [];

  for (Map<dynamic, dynamic> map in allCredentials) {
    var element = URLProtectionSpaceHttpAuthCredentials.fromMap(
        map.cast<String, dynamic>());
    if (element != null) {
      result.add(element);
    }
  }
  return result;
}