tryGetNewNameWithPath static method

String? tryGetNewNameWithPath(
  1. String filePath,
  2. String newFileName
)

Like getNewNameWithPath except that this function returns null where a similar call to getNewNameWithPath would throw a FormatException.

Implementation

static String? tryGetNewNameWithPath(String filePath, String newFileName) {
  try {
    return getNewNameWithPath(filePath, newFileName);
  } on FormatException {
    return null;
  }
}