Skip to content

Commit

Permalink
Don't stringify classes without ToStringHelper
Browse files Browse the repository at this point in the history
  • Loading branch information
abitofevrything committed Aug 21, 2023
1 parent fd56dbc commit b7014f6
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions lib/src/utils/to_string_helper/mirrors_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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>';
}
Expand Down

0 comments on commit b7014f6

Please sign in to comment.