fromMap static method

SslError? fromMap(
  1. Map<String, dynamic>? map, {
  2. EnumMethod? enumMethod,
})

Gets a possible SslError instance from a Map value.

Implementation

static SslError? fromMap(
  Map<String, dynamic>? map, {
  EnumMethod? enumMethod,
}) {
  if (map == null) {
    return null;
  }
  final instance = SslError(
    androidError: switch (enumMethod ?? EnumMethod.nativeValue) {
      EnumMethod.nativeValue => AndroidSslError.fromNativeValue(map['code']),
      EnumMethod.value => AndroidSslError.fromValue(map['code']),
      EnumMethod.name => AndroidSslError.byName(map['code']),
    },
    code: switch (enumMethod ?? EnumMethod.nativeValue) {
      EnumMethod.nativeValue => SslErrorType.fromNativeValue(map['code']),
      EnumMethod.value => SslErrorType.fromValue(map['code']),
      EnumMethod.name => SslErrorType.byName(map['code']),
    },
    iosError: switch (enumMethod ?? EnumMethod.nativeValue) {
      EnumMethod.nativeValue => IOSSslError.fromNativeValue(map['code']),
      EnumMethod.value => IOSSslError.fromValue(map['code']),
      EnumMethod.name => IOSSslError.byName(map['code']),
    },
    message: map['message'],
  );
  return instance;
}