createJsonKeys property

bool? createJsonKeys
finalinherited

If true (defaults to false), a private class _$ExampleJsonKeys class is created in the generated part file.

This class will contain every property as a String field with the JSON key as the value.

@JsonSerializable(createJsonKeys: true)
class Example {
  @JsonKey(name: 'LAST_NAME')
  String? firstName;

  // Will have the value `LAST_NAME`
  static const firstName = _$ExampleJsonKeys.firstName;
}

Implementation

final bool? createJsonKeys;