Spec-Zone.ru › Dart 2

dart:core

tryParse static method

DateTime? tryParse(
  1. String formattedString
)

Constructs a new DateTime instance based on formattedString.

Works like parse except that this function returns null where parse would throw a FormatException.

Implementation

static DateTime? tryParse(String formattedString) {
  // TODO: Optimize to avoid throwing.
  try {
    return parse(formattedString);
  } on FormatException {
    return null;
  }
}

© 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/DateTime/tryParse.html

Spec-Zone.ru

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