From 014f2edf829123797805ef8d058085ed2df36f13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Mu=CC=88ller?= Date: Thu, 24 Feb 2022 11:44:11 +0100 Subject: [PATCH 1/2] Added Equatable --- lib/country_code.dart | 6 +++++- pubspec.yaml | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/country_code.dart b/lib/country_code.dart index 3d1a6b47..a05968ca 100644 --- a/lib/country_code.dart +++ b/lib/country_code.dart @@ -1,6 +1,7 @@ import 'package:collection/collection.dart' show IterableExtension; import 'package:country_code_picker/country_codes.dart'; import 'package:country_code_picker/country_localizations.dart'; +import 'package:equatable/equatable.dart'; import 'package:flutter/cupertino.dart'; mixin ToAlias {} @@ -9,7 +10,7 @@ mixin ToAlias {} class CElement = CountryCode with ToAlias; /// Country element. This is the element that contains all the information -class CountryCode { +class CountryCode extends Equatable { /// the name of the country String? name; @@ -29,6 +30,9 @@ class CountryCode { this.dialCode, }); + @override + List get props => [name, flagUri, code, dialCode]; + @Deprecated('Use `fromCountryCode` instead.') factory CountryCode.fromCode(String isoCode) { return CountryCode.fromCountryCode(isoCode); diff --git a/pubspec.yaml b/pubspec.yaml index b0c5ab80..8ca45473 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -13,6 +13,7 @@ dependencies: modal_bottom_sheet: ^2.0.0 collection: ^1.15.0 universal_platform: ^1.0.0+1 + equatable: ^2.0.3 flutter: assets: From 344729ee23e250952c5b693b1132a5fc49827ea0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Mu=CC=88ller?= Date: Thu, 24 Feb 2022 11:55:57 +0100 Subject: [PATCH 2/2] nullable Object --- lib/country_code.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/country_code.dart b/lib/country_code.dart index a05968ca..f098b4da 100644 --- a/lib/country_code.dart +++ b/lib/country_code.dart @@ -31,7 +31,7 @@ class CountryCode extends Equatable { }); @override - List get props => [name, flagUri, code, dialCode]; + List get props => [name, flagUri, code, dialCode]; @Deprecated('Use `fromCountryCode` instead.') factory CountryCode.fromCode(String isoCode) {