extractArrayPath function
Helper method to extract array path without the trailing index
For example, "items0" becomes "items",
"item.array0.name" becomes "item.array".
Useful for handling array manipulations that touches the entire array
rather than a specific index.
Implementation
String extractArrayPath(String fullFieldKey) {
final match = RegExp(r'^(.+)\[\d+\]$').firstMatch(fullFieldKey);
return match?.group(1) ?? fullFieldKey;
}