parse static method

DoubleRange? parse(
  1. String? input, {
  2. bool? startInclusive,
  3. bool? endInclusive,
})

Parses a string representation of a double range.

The input string should be in one of the following formats:

  • [double,double] (inclusive start and end)
  • [double,double) (inclusive start, exclusive end)
  • (double,double] (exclusive start, inclusive end)
  • (double,double) (exclusive start and end)
  • (-infinity,infinity) (open range)
  • (-infinity,double] or (-infinity,double) (open start, inclusive/exclusive end)
  • [double,infinity) or (double,infinity) (inclusive/exclusive start, open end)

Returns a DoubleRange instance if the input is valid, otherwise returns null.

Implementation

static DoubleRange? parse(String? input, {bool? startInclusive, bool? endInclusive}) {
  final range = Range._parse<num>(input,
      regexInfInf: regexInfInf,
      regexInfVal: regexInfVal,
      regexValInf: regexValInf,
      regexValVal: regexValVal,
      parser: (val) => double.parse(val),
      ctor: () => DoubleRange._(),
      startInclusive: startInclusive,
      endInclusive: endInclusive) as DoubleRange?;
  return range;
}