extractFromUVCI static method
returns The fragment with given index from the UVCI string
(see Annex 2 in the UVCI specification),
or null
when that fragment doesn't exist.
Implementation
static String? extractFromUVCI(String? uvci, int index) {
if (uvci == null || index < 0) {
return null;
}
final prefixlessUvci = uvci.startsWith(optionalPrefix)
? uvci.substring(optionalPrefix.length)
: uvci;
final fragments = prefixlessUvci.split(RegExp(r'[/#:]'));
return index < fragments.length ? fragments[index] : null;
}