Beispiel
Demonstrate how Equatable runtimeType and property identity affect generic and collection equality
sha256:5c27c62458688e4ad17910025eef68c78ea3ce05d37db332add13fcfe5ddc813
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Ausführungsbelege
Deklarierte Umgebung und signierte Prüfläufe werden getrennt dargestellt.
BeleggrundlageSignierter Vertrag bestanden
Verifizierungsbelege1
VerifizierungsstufeL3_CONTRACT_PASS
Deklarierte Umgebung
- Ausführungskontext
- dart
- Betriebssystem
- linux
- Architektur
- x64
- Runtime
- dart
- Sprache
- dart
- Paketmanager
- pub
Umgebungen der Verifizierungsläufe
- Ausführungskontext
- dart 3
- Betriebssystem
- linux debian · glibc
- Architektur
- x64
- Runtime
- dart 3
- Sprache
- dart
- Paketmanager
- pub
- Ausführung
- container · docker
CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · pub@1 · 2026-08-17
Fall
- Ziel
- Demonstrate how Equatable runtimeType and property identity affect generic and collection equality HOW
- Pakete
-
equatable 2.1.0
- Umgebung
- dart
- Erstellt
- 2026-08-17T03:53:35Z
Häufige Annahme
Two generic Equatable instances with identical values are equal when one type argument is a subtype of the other, such as Box<num>(42) and Box<int>(42).
So hat der Autor des Samples festgehalten, was eine Entwicklerin oder ein Modell hier erwarten würde. Der Vertrag darunter ist das, was tatsächlich lief.
Contract
- Two generic Equatable instances with identical values are not equal when type arguments differ across subtype boundaries, and their runtimeType-dependent hashCodes differ.
- Box<Object?> and Box<dynamic> holding the same value are not equal because Dart reifies dynamic and Object? as distinct runtime types.
- Non-generic Equatable classes holding generic collections with identical elements are equal across List<num> and List<int> because collection equality compares element values.
- Two distinct holders of the shared double.nan constant compare equal because Equatable checks identical property objects before numeric equality.
- A subclass inheriting identical props is not equal to its generic parent instance in either direction.
Dateien
- NOTES.md
- csx.json
- lib/generic_value.dart
- pubspec.lock
- pubspec.yaml
- test/contract.dart
Quellartefakt herunterladen (tar.gz)
Ursprungs-Seeder
csx-seed
Verifizierungsbelege
- dart 3 · linux debian/x64 · docker · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · pub@1 · 2026-08-17 · ed25519:d91480838ac982c9