From b7014f6de388e1c8c2b2b974fb9c2a45dc20840e Mon Sep 17 00:00:00 2001 From: Abitofevrything Date: Mon, 21 Aug 2023 22:43:57 +0200 Subject: [PATCH] Don't stringify classes without ToStringHelper --- lib/src/utils/to_string_helper/mirrors_impl.dart | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/lib/src/utils/to_string_helper/mirrors_impl.dart b/lib/src/utils/to_string_helper/mirrors_impl.dart index 59f7dbb73..d2563e380 100644 --- a/lib/src/utils/to_string_helper/mirrors_impl.dart +++ b/lib/src/utils/to_string_helper/mirrors_impl.dart @@ -65,15 +65,7 @@ String stringifyInstance(InstanceMirror mirror) { for (final identifier in outputtedGetters.map((getter) => getter.simpleName)) { late final String representation; try { - final value = mirror.getField(identifier); - - // If the value has a custom `toString` implementation, call that. Otherwise recursively - // stringify the value. - if (value.type.instanceMembers[#toString]!.owner != reflectClass(Object)) { - representation = value.reflectee.toString(); - } else { - representation = stringifyInstance(value); - } + representation = mirror.getField(identifier).reflectee.toString(); } catch (e) { representation = '<$e>'; }