getPlatformAuthenticatorsWithCb method

Future<void> getPlatformAuthenticatorsWithCb(
  1. dynamic onSuccess({
    1. List<AuthenticatorMetadata?>? result,
    }),
  2. dynamic onFailure({
    1. String? errString,
    2. int? errorCode,
    })
)

Implementation

Future<void> getPlatformAuthenticatorsWithCb(
  Function({List<AuthenticatorMetadata?>? result}) onSuccess,
  Function({int? errorCode, String? errString}) onFailure,
) async {
  dynamic res = await _channel.invokeMethod('getPlatformAuthenticatorsCb');
  if (res == null) {
    return;
  }
  if (res.runtimeType == String) {
    dynamic list = json.decode(res as String);
    onSuccess(
      result: (list as List<dynamic>).map((dynamic e) {
        return e != null ? AuthenticatorMetadata.fromMap(e) : null;
      }).toList(),
    );
  } else {
    Map<dynamic, dynamic> result = Map<dynamic, dynamic>.from(res);
    onFailure(
      errorCode: result['errorCode'],
      errString: result['errString'],
    );
  }
}