extractFileName static method

String extractFileName(
  1. String url
)

Implementation

static String extractFileName(String url) {
  // Extract the file name from the URL
  final fileName = url.split('/').last;

  // Use a regular expression to find the part after "-file-"
  final match = RegExp(r'-file-(.+)$').firstMatch(fileName);

  // If a match is found, return the matched group; otherwise, return the original file name
  return match != null ? match.group(1)! : fileName;
}