DurationPrinter class

Prints Duration objects in custom ways.

For example, to print dates in the format YYYY-MM-DD call the constructor and configure the printer as such:

final printer = DurationPrinter((builder) => builder
    ..year(width: 4)
    ..literal('-')
    ..month(width: 2)
    ..literal('-')
    ..day(width: 2));
Inheritance
Available Extensions

Constructors

DurationPrinter(Callback1<DurationPrinterBuilder> callback, {Map<TimeUnit, num> conversion = casualConversion})
Constructor to build a DurationPrinter.
factory

Properties

defaultToStringPrinter ObjectPrinter
Override to configure the empty ObjectPrinter.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
printers Iterable<Printer<Duration>>
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
toStringPrinter ObjectPrinter
Override and call super to add values to the ObjectPrinter.
no setterinherited

Methods

call(Duration object) String
Prints the object.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
print(Duration object) String
Returns the printed object.
inherited
printOn(Duration object, StringBuffer buffer) → void
Prints the object into buffer.
inherited
toString() String
Standard toString implementation. Do not override, instead implement toStringPrinter to customize.
inherited

Operators

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

Static Methods

dart() DurationPrinter
Returns the standard Dart duration format.
iso8601() DurationPrinter
Returns an ISO-8601 extended full-precision format representation.