isLikelyFile method

bool isLikelyFile(
  1. String path
)

Returns true if the path is likely a file (based on extension or path format)

Implementation

bool isLikelyFile(String path) {
  String ext = p.extension(path).toLowerCase();
  if (path.endsWith(p.separator) || path.endsWith('/')) {
    return false;
  }
  if (ext.isNotEmpty) {
    return true;
  }
  return ext.isEmpty ? false : true;
}