From 10cbfd8563bfa6693687cb7ef700dca5c995a25a Mon Sep 17 00:00:00 2001 From: Felix Angelov Date: Mon, 2 Jun 2025 17:27:44 -0500 Subject: [PATCH] feat(code_push_protocol): make `Patch` extend `Equatable` (#3138) --- .../shorebird_code_push_protocol/lib/src/models/patch.dart | 6 +++++- .../test/src/models/patch_test.dart | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/shorebird_code_push_protocol/lib/src/models/patch.dart b/packages/shorebird_code_push_protocol/lib/src/models/patch.dart index 67ed1432..e4feba30 100644 --- a/packages/shorebird_code_push_protocol/lib/src/models/patch.dart +++ b/packages/shorebird_code_push_protocol/lib/src/models/patch.dart @@ -1,3 +1,4 @@ +import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; part 'patch.g.dart'; @@ -8,7 +9,7 @@ part 'patch.g.dart'; /// multiple patches can be published for a given app release version. /// {@endtemplate} @JsonSerializable() -class Patch { +class Patch extends Equatable { /// {@macro patch} const Patch({required this.id, required this.number, this.notes}); @@ -29,4 +30,7 @@ class Patch { /// /// This value is freeform text with no assumptions about content or format. final String? notes; + + @override + List get props => [id, number, notes]; } diff --git a/packages/shorebird_code_push_protocol/test/src/models/patch_test.dart b/packages/shorebird_code_push_protocol/test/src/models/patch_test.dart index d6ab6d82..75a6a271 100644 --- a/packages/shorebird_code_push_protocol/test/src/models/patch_test.dart +++ b/packages/shorebird_code_push_protocol/test/src/models/patch_test.dart @@ -6,6 +6,7 @@ void main() { test('can be (de)serialized', () { const patch = Patch(id: 1, number: 2, notes: 'some notes'); expect(Patch.fromJson(patch.toJson()).toJson(), equals(patch.toJson())); + expect(Patch.fromJson(patch.toJson()), equals(patch)); }); }); }