detypify method
Implementation
Object? detypify() {
final [_, ...other] = split('#');
if (other.isEmpty) {
// enters here if there is only a type, e.g. `people`
return null;
}
final [intId, ...rest] = other;
if (intId.isEmpty) {
// means it is a string id people##
if (rest.isEmpty) {
// means it has no assigned ID: people#
return null;
} else {
// need to re-join with # in case there were other #s in the id
return rest.join('#');
}
} else {
// means it's an int: e.g people#1
return int.parse(intId);
}
}