operator [] method
Gets the value of a nested field by name.
Parameters:
name
: The name of the nested field.
Returns:
- The value of the nested field.
Throws:
Exception
if the field does not exist.
Implementation
operator [](String name) {
if (rawValue == null) {
return null;
}
for (final field in rawValue!.fields) {
if (field.fieldName == name) {
return field.value;
}
}
throw Exception("Field $name does not exist");
}