toMSFromSource static method
Converts a date string to milliseconds since epoch.
Example:
String dateString = "2024-02-06";
int dateMS = DateProvider.toMSFromSource(dateString);
print(dateMS); // Output: milliseconds since epoch for 06-02-2024
Implementation
static int toMSFromSource(String? source) {
return DateTime.tryParse(source ?? "")?.millisecondsSinceEpoch ?? 0;
}