Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Allow 'value' to be used outside of enums by separating exception words. #773

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

xioxin
Copy link

@xioxin xioxin commented Oct 24, 2024

In the upgrade to 3.0.1, I found that the value field in the model was changed to $value. However, value is not a reserved word in Dart.

@JsonSerializable(explicitToJson: true)
class StatisticalLabel {
  const EnrollStatisticsLabel({
    required this.describe,
    required this.$value,
    this.unit,
  });

  @JsonKey(name: 'describe')
  final String describe;
  @JsonKey(name: 'value')
  final String $value;
  @JsonKey(name: 'unit')
  final String? unit;
....

Upon checking the code, I discovered that #716 added value to exceptionWords to resolve conflicts with the value parameter in enums.


I added exceptionWordsInEnum to ensure that value is treated as an exception only within enums.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant