RegisterResponseType.fromJson constructor

RegisterResponseType.fromJson(
  1. Map<String, dynamic> json
)

Constructs a new instance from a JSON map.

Implementation

factory RegisterResponseType.fromJson(Map<String, dynamic> json) {
  final response = json['response'];
  if (response is! Map<String, dynamic>) {
    throw FormatException(
        'Expected "response" to be a Map, got ${response.runtimeType}');
  }
  final transports = response['transports'] as List<dynamic>?;

  return RegisterResponseType(
    id: json['id'] as String? ?? '',
    rawId: json['rawId'] as String? ?? '',
    clientDataJSON: response['clientDataJSON'] as String? ?? '',
    attestationObject: response['attestationObject'] as String? ?? '',
    transports: transports?.map((e) => e as String?).toList() ?? [],
  );
}