This commit is contained in:
2025-03-26 13:12:56 +02:00
parent 1da72c7413
commit 65a06f1591

View File

@@ -38,13 +38,16 @@ class AstromicFormController extends FormController {
}) : super(controllers: extraControllers) { }) : super(controllers: extraControllers) {
// Add states and messages based on initial controller. // Add states and messages based on initial controller.
_addInitialControllers(); _addInitialControllers();
// Listen on the error stream for values and push to the corresponding field state.
// if (errorStream != null) {
// _handleErrorStream();
// }
} }
/// Get all the available controllers with their current values
Map<String, String> get allControllers => Map<String, String>.fromEntries(<String, (String?, bool)>{
...?controllers,
...?super.controllers,
}.entries.map((MapEntry<String, (String?, bool)> entry) => MapEntry<String, String>(entry.key, value(entry.key))).toList());
bool hasKey(String id) => allControllers.containsKey(id);
/// Get the field state and message of a specific field using it's ID. /// Get the field state and message of a specific field using it's ID.
(AstromicFieldState, String? message)? getState(String fieldId) { (AstromicFieldState, String? message)? getState(String fieldId) {
if (fieldStates.containsKey(fieldId)) { if (fieldStates.containsKey(fieldId)) {