getFieldSchema method
Retrieves the schema for a specific field by its ID.
Returns null if the field is not found.
Implementation
Map<String, dynamic>? getFieldSchema(String fieldId) {
final container = schema['container'] as Map<String, dynamic>?;
if (container == null || container['elements'] == null) {
return null;
}
final elements = container['elements'] as List;
try {
return elements.firstWhere(
(element) => (element as Map)['id'] == fieldId,
orElse: () => throw Exception('Field not found: $fieldId'),
)
as Map<String, dynamic>;
} catch (e) {
throw Exception('Field not found: $fieldId');
}
}