From 9f3076eecfb5429d9834930faec5b0fec450336b Mon Sep 17 00:00:00 2001 From: Vladislav Polyakov <39828645+polRk@users.noreply.github.com> Date: Wed, 23 Dec 2020 18:24:24 +0300 Subject: [PATCH] fix: show all props in toString() method --- lib/src/equatable_utils.dart | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/src/equatable_utils.dart b/lib/src/equatable_utils.dart index 2c91fd4e..2d5e0a6a 100644 --- a/lib/src/equatable_utils.dart +++ b/lib/src/equatable_utils.dart @@ -56,5 +56,16 @@ int _finish(int hash) { } /// Returns a string for [props]. -String mapPropsToString(Type runtimeType, List props) => - '$runtimeType${props?.map((prop) => prop?.toString() ?? '') ?? '()'}'; +String mapPropsToString(Type runtimeType, List props) { + var strings = []; + + for (var prop in props) { + final str = prop?.toString() ?? ''; + if (str.isNotEmpty) { + strings.add(str); + } + } + + return '$runtimeType(${strings.join(', ')})' ; +} +