Safely convert a value to a String description.
The conversion is guaranteed to not throw, so it won't use the object's toString method.
static String safeToString(Object object) {
if (object is num || object is bool || null == object) {
return object.toString();
}
if (object is String) {
return _stringToSafeString(object);
}
return _objectToString(object);
}
© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.5.0/dart-core/Error/safeToString.html