fromKey method

TranslationFormat<FileData> fromKey(
  1. String key,
  2. {Map<String, TranslationFormatBuilder> supportedFormats}
)

Implementation

static TranslationFormat fromKey(
  String key, {
  Map<String, TranslationFormatBuilder> supportedFormats,
}) {
  final formats = supportedFormats ?? defaultFormats;
  final translationFormat = formats[key]?.call();

  if (translationFormat == null) {
    throw UnsupportedFormatException(key);
  }
  return translationFormat;
}