pathSegments static method

List<String> pathSegments(
  1. String path
)

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(),
    ];