KEqVCodec constructor

KEqVCodec({
  1. Quoting quoting = Quoting.doubleQuote,
  2. int keySpacing = 1,
  3. int valueSpacing = 1,
})

Create KEqVCodec instance and specified preferences during encode.

The quoting can be Quoting.singleQuote or Quoting.doubleQuote to esacpes String that it prevents parsing the String to another data type.

Apply keySpacing and valueSpacing will affects padding spaces on equal symbol. It should be non-negative int with default value as 1. ArgumentError will be thrown if attempted to assign negative int.

It is encouraged to uses keqv constant if no preferences need to be changed.

Implementation

factory KEqVCodec(
    {Quoting quoting = Quoting.doubleQuote,
    int keySpacing = 1,
    int valueSpacing = 1}) {
  if (<int>[keySpacing, valueSpacing].any((element) => element < 0)) {
    throw ArgumentError.value(
        (keySpacing, valueSpacing),
        "(keySpacing, valueSpacing)",
        "Spacing value should not be an negative integer.");
  }

  return KEqVCodec._(quoting, keySpacing, valueSpacing);
}