parse static method

LocalTime parse(
  1. String formattedString
)

Creates a new LocalTime from a formattedString.

Expects a string in the format HH:MM:SS[.ssssss], without any timezone. Throws a FormatException is the string cannot be parsed.

Implementation

static LocalTime parse(String formattedString) {
  if (!_localTimeRegex.hasMatch(formattedString)) {
    throw FormatException("invalid LocalTime format", formattedString);
  }
  return LocalTime.fromDateTime(
      DateTime.parse('1970-01-01T${formattedString}Z'));
}