CollationOptions constructor

CollationOptions(
  1. String locale, {
  2. int? strength,
  3. bool caseLevel = false,
  4. String? caseFirst,
  5. bool numericOrdering = false,
  6. String? alternate,
  7. String? maxVariable,
  8. bool backwards = false,
  9. bool normalization = false,
})

Implementation

CollationOptions(this.locale,
    {this.strength,
    this.caseLevel = false,
    this.caseFirst,
    this.numericOrdering = false,
    this.alternate,
    this.maxVariable,
    this.backwards = false,
    this.normalization = false}) {
  if (strength != null && (strength! < 1 || strength! > 5)) {
    throw MongoDartError(
        'The allowed values for the strngt parameter are 1 to 5');
  }
  if (caseFirst != null && !_caseFirstValidValues.contains(caseFirst)) {
    throw MongoDartError(
        'invalid value "$caseFirst" for the caseFirst parameter');
  }
  if (alternate != null && !_alternateValidValues.contains(alternate)) {
    throw MongoDartError(
        'invalid value "$alternate" for the alternate parameter');
  }
  if (maxVariable != null && !_maxVariableValidValues.contains(maxVariable)) {
    throw MongoDartError(
        'invalid value "$maxVariable" for the maxVariable parameter');
  }
}