fromArgs static method

EmbedMode fromArgs(
  1. Map<String, String?> args
)

Implementation

static EmbedMode fromArgs(Map<String, String?> args) {
  final embedMode = args[_embedModeKey];
  if (embedMode != null) {
    return switch (embedMode) {
      _embedModeManyValue => EmbedMode.embedMany,
      _embedModeOneValue => EmbedMode.embedOne,
      _ => EmbedMode.none,
    };
  }

  if (args[_legacyEmbedKey] == 'true') {
    // Handle legacy query parameters that may set 'embed' to 'true'
    return EmbedMode.embedOne;
  }

  return EmbedMode.none;
}