getFileSuffix static method

String? getFileSuffix(
  1. String fileName, {
  2. bool keepDot = false,
})

获取文件名后缀

Implementation

static String? getFileSuffix(String fileName, {bool keepDot = false}) {
  String suffixName = p.extension(fileName);
  if (isEmpty(suffixName)) return null;
  if (keepDot) return suffixName;
  if (suffixName.startsWith('.')) return suffixName.replaceFirst('.', '');

  return null;
}