isValidFilePath method

bool isValidFilePath()

Implementation

bool isValidFilePath() {
  // Ensure it contains a valid separator, but not JUST a separator
  if (trim().isEmpty) return false; // Empty string is invalid
  if (endsWith("/") || endsWith("\\")) {
    return false; // Ends with "/" or "\" is invalid
  }
  if (!contains(Platform.pathSeparator)) {
    return false; // Must contain at least one "/"
  }

  return true; // Otherwise, it's a valid path
}