From 4ad3c76eeb6195ac40daa9093a67303aaa527778 Mon Sep 17 00:00:00 2001 From: Abitofevrything <54505189+abitofevrything@users.noreply.github.com> Date: Mon, 21 Aug 2023 16:02:54 -0700 Subject: [PATCH] Don't stringify classes without ToStringHelper (#520) --- 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>'; }