addPattern method

  1. @override
DateFormat addPattern(
  1. String? inputPattern, [
  2. String separator = ' '
])

Add inputPattern to this instance as a pattern.

If there was a previous pattern, then this appends to it, separating the two by separator. inputPattern is first looked up in our list of known skeletons. If it's found there, then use the corresponding pattern for this locale. If it's not, then treat inputPattern as an explicit pattern.

Implementation

@override
DateFormat addPattern(String? inputPattern, [String separator = ' ']) {
  // TODO(alanknight): This is an expensive operation. Caching recently used
  // formats, or possibly introducing an entire 'locale' object that would
  // cache patterns for that locale could be a good optimization.
  // If we have already parsed the format fields, reset them.
  _formatFieldsPrivate = null;
  return super.addPattern(inputPattern, separator);
}