feat(code_push_protocol): make Patch extend Equatable (#3138)

This commit is contained in:
Felix Angelov
2025-06-02 17:27:44 -05:00
committed by GitHub
parent 624e408485
commit 10cbfd8563
2 changed files with 6 additions and 1 deletions
@@ -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<Object?> get props => [id, number, notes];
}
@@ -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));
});
});
}