pathSegments static method
a.b[0].c → [a, b, 0, c].
Implementation
static List<String> pathSegments(String path) => [
for (final s in path.replaceAll('[', '.').replaceAll(']', '').split('.'))
if (s.trim().isNotEmpty) s.trim(),
];