fromTimestamp static method
Creates DateTime from timestamp (supports both seconds and milliseconds)
Implementation
static DateTime fromTimestamp(int timestamp) {
// Check if timestamp is in milliseconds (13 digits) or seconds (10 digits)
if (timestamp.toString().length == 13) {
return DateTime.fromMillisecondsSinceEpoch(timestamp);
} else {
return DateTime.fromMillisecondsSinceEpoch(timestamp * 1000);
}
}