CodeSampleX

Beispiel

json_annotation 4.9.0: Configure JsonSerializable options and enum decoding fallbacks in json_annotation, proving snake_case key enforcement, unknownEnumValue null bypass, and readValue error attribution

Verifiziertes Beispiel für pub json_annotation 4.9.0: Configure JsonSerializable options and enum decoding fallbacks in json_annotation, proving snake_case…

sha256:eabf9843a09e0a2fac2d9fe9f0df3eebd2f3eef2bf42bdd99120e6754d499267

Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen. Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen. MIT-0

Ausführungsbelege

Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.

Beleggrundlage
Signierter Vertrag bestanden
Verifizierungsbelege
2
Signaturschlüssel, die es gebaut haben
2
Deklarierte Umgebung dart linux x64 dart dart pub

Umgebungen der Verifizierungsläufe

Umgebung Contract Stufen Lauf
dart 3 · linux debian/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · pub@1
2026-08-17
dart 3 · linux debian/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · pub@1
2026-08-18

Fall

HOW
Ziel
Configure JsonSerializable options and enum decoding fallbacks in json_annotation, proving snake_case key enforcement, unknownEnumValue null bypass, and readValue error attribution
Pakete
Symbole
  • JsonSerializable
  • JsonSerializable.fromJson
  • FieldRename
  • JsonKey.unknownEnumValue
  • JsonKey.nullForUndefinedEnumValue
  • JsonKey.readValue
  • $enumDecode
  • $enumDecodeNullable
  • $checkedCreate
  • $checkedConvert
  • $checkKeys
  • CheckedFromJsonException
  • UnrecognizedKeysException
  • MissingRequiredKeysException
  • DisallowedNullValueException
Umgebung
dart
Erstellt
2026-08-17T14:38:30Z

Contract

  1. JsonSerializable.fromJson enforces snake_case option keys and disallowUnrecognizedKeys, throwing a CheckedFromJsonException with badKey true on camelCase Dart property names
  2. field_rename configuration parses exact enum string identifiers and throws an ArgumentError wrapped in CheckedFromJsonException on non-matching strings like screaming_snake
  3. $enumDecodeNullable returns the unknownValue fallback for unrecognized wire strings but returns null when the input is null, while non-nullable $enumDecode throws ArgumentError on null inputs even when unknownValue is provided
  4. JsonKey.nullForUndefinedEnumValue causes $enumDecodeNullable to map unrecognized wire strings to null, but passing an incompatible enum type throws an ArgumentError
  5. readValue custom extractors allow retrieving values from nested paths or aliases, and type mismatch exceptions are re-attributed to the target model field key in CheckedFromJsonException
  6. $checkKeys evaluates allowedKeys first, requiredKeys second, and disallowNullValues last, where disallowNullValues ignores completely absent keys unless combined with requiredKeys
  7. $checkedNew attaches the failing key name to CheckedFromJsonException for missing and disallowed-null keys, but leaves key as null for UnrecognizedKeysException

Dateien

  • NOTES.md
  • csx.json
  • lib/account_config.dart
  • pubspec.lock
  • pubspec.yaml
  • test/contract.dart

Quellartefakt herunterladen (tar.gz)

Ursprungs-Seeder

csx-seed