validation_form/utils/form_data_utils library

Functions

addReactiveArrayItem(Map<String, dynamic> formData, String arrayPath, Map<String, dynamic> newItem) → void
Adds a reactive item to a nested array
buildFormFieldKey(List<String> pathSegments) String
Builds a key path for deeply nested form fields
createReactiveFormData(Map<String, dynamic> data) Map<String, dynamic>
Creates a reactive nested structure from a regular map
extractArrayPath(String fullFieldKey) String
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.
extractFirstPlaceholderKey(String text) String?
Extracts placeholder keys from text and replaces them with values from contexts subsequently
getAllFormFieldPaths(Map<String, dynamic> formData, {String prefix = '', bool includeEmptyContainers = true}) List<String>
Gets all field paths from form data (useful for validation or iteration)
getNestedFormValue(Map<String, dynamic> formData, String path) → dynamic
Gets a value from deeply nested form data using a path Supports both dot notation and bracket notation for arrays Examples:
hasNestedFormField(Map<String, dynamic> formData, String path) bool
Utility to check if a field exists in the form data
removeNestedFormField(Map<String, dynamic> formData, String path) → void
Removes a field from nested form data
removeReactiveArrayItem(Map<String, dynamic> formData, String arrayPath, int index) → void
Removes an item from a reactive nested array
setNestedFormValue(Map<String, dynamic> formData, String path, dynamic value) → void
Sets a value in deeply nested form data using a path Creates intermediate objects/arrays as needed with proper GetX reactivity