List<String?> parseKey(String key) { // examples: albedoTexture, Light[2].position, or Foo.bar final regex = RegExp(r'^(\w+)(?:\[(\d+)\])?(?:\.(\w+))?$'); return regex.firstMatch(key)?.groups([1, 2, 3]) ?? []; }