This whole method is a little too convoluted.
It's really two things:
- generate category recursively
- generate category item at leaf

So do this this way:

```dart
_generateContent(String name, Map<String, String> map, bool isCategory => isCategory ? generateCategory(name, map) : generateItem(name, map);

generateCategory(String name, Map<String, String> map) => map.keys.map((String k) => ...
```

Actually, this whole method is so convoluted I can't even process how to do it easily right now. :[

I'd use the method refactoring in the editor to split this up and then recombine it.