fromMap static method

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

Gets a possible DownloadStartResponse instance from a Map value.

Implementation

static DownloadStartResponse? fromMap(
  Map<String, dynamic>? map, {
  EnumMethod? enumMethod,
}) {
  if (map == null) {
    return null;
  }
  final instance = DownloadStartResponse(
    action: switch (enumMethod ?? EnumMethod.nativeValue) {
      EnumMethod.nativeValue => DownloadStartResponseAction.fromNativeValue(
        map['action'],
      ),
      EnumMethod.value => DownloadStartResponseAction.fromValue(
        map['action'],
      ),
      EnumMethod.name => DownloadStartResponseAction.byName(map['action']),
    },
    handled: map['handled'],
    resultFilePath: map['resultFilePath'],
  );
  return instance;
}