Realtime.fromDateTime constructor
Realtime.fromDateTime(
- DateTime dateTime
Constructs a Realtime instance from the specified DateTime.
Example:
DateTime myDateTime = DateTime.now().subtract(Duration(hours: 2, minutes: 30));
Realtime myTime = Realtime.fromDateTime(myDateTime);
print(myTime.isHourMode); // Output: true
Implementation
factory Realtime.fromDateTime(DateTime dateTime) {
return Realtime.fromDuration(
DateTime.now().difference(dateTime),
);
}