fromMap static method

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

Gets a possible HttpAuthResponse instance from a Map value.

Implementation

static HttpAuthResponse? fromMap(
  Map<String, dynamic>? map, {
  EnumMethod? enumMethod,
}) {
  if (map == null) {
    return null;
  }
  final instance = HttpAuthResponse();
  instance.action = switch (enumMethod ?? EnumMethod.nativeValue) {
    EnumMethod.nativeValue => HttpAuthResponseAction.fromNativeValue(
      map['action'],
    ),
    EnumMethod.value => HttpAuthResponseAction.fromValue(map['action']),
    EnumMethod.name => HttpAuthResponseAction.byName(map['action']),
  };
  if (map['password'] != null) {
    instance.password = map['password'];
  }
  if (map['permanentPersistence'] != null) {
    instance.permanentPersistence = map['permanentPersistence'];
  }
  if (map['username'] != null) {
    instance.username = map['username'];
  }
  return instance;
}