parse static method

DateRangeUtil parse(
  1. String daterangeutilString, [
  2. String seperator = '/'
])

Implementation

static DateRangeUtil parse(String daterangeutilString,[String seperator='/']) {
  final lines = daterangeutilString.split(seperator);
  if(lines.length == 2){
    try {
      return DateRangeUtil(start: DateTime.parse(lines[0]), end: DateTime.parse(lines[1]), seperator: seperator);
    } catch (e) {
      throw 'Unexpected date format';
    }
  }
  throw 'Unexpected date range format';
}