asImageFilePath function
Clean and normalize a text string that might be an image file path.
Implementation
String? asImageFilePath(String text) {
final cleaned = _removeOuterQuotes(text.trim());
final unescaped = _stripBackslashEscapes(cleaned);
if (imageExtensionRegex.hasMatch(unescaped)) return unescaped;
return null;
}