countTopicsInStructure function
- List topics
Count total topics including nested children.
Implementation
@visibleForTesting
int countTopicsInStructure(List<dynamic> topics) {
var count = 0;
for (final t in topics) {
count += 1;
if (t is Map<String, dynamic>) {
final children = t['children'];
if (children is List) count += countTopicsInStructure(children);
}
}
return count;
}