shortCodeOfPath function
The short code a link URL's path names, or null when the path is not
exactly one code segment.
Implementation
String? shortCodeOfPath(String path) {
final segments = path.split('/').where((s) => s.isNotEmpty).toList();
if (segments.length != 1) return null;
final code = segments.single;
return isShortCode(code) ? code : null;
}