parseFile static method
Tries to parse a File.
- Returns
def
ifvalue
is invalid.
Implementation
static File? parseFile(Object? value, [File? def]) {
if (value == null) return def;
if (value is File) {
return value;
} else if (value is Directory) {
return File(value.path);
} else {
var s = value.toString().trim();
if (s.isEmpty) return def;
return File(s);
}
}