toDateOrNull method

DateTime? toDateOrNull()

convert String to DateTime if is possible else will return null

Implementation

DateTime? toDateOrNull() => DateTime.tryParse(this);