recognizedModelFormat function

ModelFormat? recognizedModelFormat(
  1. String fileName
)

The format fileName's own extension names, or null when it names none of the four this package reads.

Read off builtInModelExtensions, the one place this package's own list of extensions is written down. _resolveFormat reads it for the same reason a drop target does — ui-31n's own "drop неизвестного расширения": a caller deciding whether a dropped file is one this application can open needs the same answer decodeModel itself would give, not a second list of suffixes kept beside this one that could name a fifth format this package still could not read. A caller with decoders of its own asks canDecodeFileName instead.

Implementation

ModelFormat? recognizedModelFormat(String fileName) {
  final name = fileName.toLowerCase();
  for (final MapEntry<String, ModelFormat> each
      in builtInModelExtensions.entries) {
    if (name.endsWith(each.key)) return each.value;
  }
  return null;
}