Spec-Zone.ru › Dart 2

dart:core

safeToString static method

String safeToString(
  1. Object? object
)

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 except for specific known and trusted types.

Implementation

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 BSD 3-Clause "New" or "Revised" License.
https://api.dart.dev/stable/2.19.6/dart-core/Error/safeToString.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API