I can't define empty datetime in dart. And I don't know the answer to this question
I looked on the internet but couldn't find any solution.
CodePudding user response:
I think it would be better make it null-able .
DateTime? date;
More about null-safety
CodePudding user response:
DateTime emptyDateTime = DateTime.fromMillisecondsSinceEpoch(0);
outputs the value :
1970-01-01 00:00:00.000
CodePudding user response:
Another way. First second of our era.
final date = DateTime(1);
print(date);
Output:
0001-01-01 00:00:00.000