UnixTimestampConverter class

Implements serialization and deserialization for DateTime from and to int.

The integer is expected to be a Unix timestamp in seconds.

Usage:

@JsonSerializable()
class MyClass {
  @JsonKey(name: 'timestamp')
  @UnixTimestampConverter()
  final DateTime timestamp;

  const MyClass(this.timestamp);
}
Inheritance

Constructors

UnixTimestampConverter()
Implements serialization and deserialization for DateTime from and to int.
const

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

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

Operators

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