You almost had it right. You just did not use a named constructor:
void main() {
print(DateTime.now().millisecondsSinceEpoch);
}
Gives:
1351441456747
See the API documentation for more: https://api.dart.dev/stable/2.10.1/dart-core/DateTime-class.html