DateFormatter class

Production-safe date formatting helpers.

Constructors

DateFormatter()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

format(DateTime? date, {String pattern = defaultFormat, String fallbackValue = fallback, String? locale}) String
Backward-compatible alias for nullable formatting.
formatApiDate(String? dateString, {String format = defaultFormat, String? locale, bool toLocal = true}) String
Parses an API date string and formats it for display.
formatDate(DateTime date, {String format = defaultFormat, String? locale}) String
Formats a non-null date using the given format.
formatNullableDate(DateTime? date, {String format = defaultFormat, String? locale}) String
Formats a nullable date.
fromApi(String? value, {String outputPattern = defaultFormat, List<String> inputPatterns = apiInputFormats, String fallbackValue = fallback, String? locale, bool toLocal = true}) String
Backward-compatible alias for API string formatting.
parse(String? value, {List<String> inputPatterns = apiInputFormats, bool toLocal = true}) DateTime?
Parses a nullable string into a DateTime.

Constants

apiInputFormats → const List<String>
Common API date input patterns.
defaultFormat → const String
Default date format for human-readable UI values.
fallback → const String
Placeholder returned for null and invalid values.
supportedFormats → const List<String>
Supported date patterns for display and parsing.