resolveExtension static method
Extension to store the file under: the real one from filePath when it
is a known media type, otherwise the historical default for mediaType.
Implementation
static String resolveExtension({String? filePath, required MediaType mediaType}) {
if (filePath != null) {
final fromPath = extensionFromPath(filePath);
if (fromPath != null) return fromPath;
}
return defaultExtensionFor(mediaType);
}