tryParse static method

LocalTime? tryParse(
  1. String formattedString
)

Creates a new LocalTime from a formattedString, or null if the string is not a valid time.

Expects a string in the format HH:MM:SS[.ssssss], without any timezone.

Implementation

static LocalTime? tryParse(String formattedString) {
  try {
    return parse(formattedString);
  } on FormatException {
    return null;
  }
}