getParentNamespaces static method
Get all parent namespaces of a channel
Implementation
static List<String> getParentNamespaces(String channel) {
if (!channel.startsWith('/')) {
return [];
}
final segments = channel.split('/').where((s) => s.isNotEmpty).toList();
final namespaces = <String>[];
for (int i = 0; i < segments.length; i++) {
final namespace = '/${segments.take(i + 1).join('/')}';
namespaces.add(namespace);
}
return namespaces;
}