writeArray method

bool writeArray(
  1. List value, [
  2. bool indefinite = false,
  3. int? length
])

Array primitive. Valid elements are string, integer, bool, float(any size), array or map. Returns true if the encoding has been successful. If you supply a length this will be used and not calculated from the array size, unless you are encoding certain indefinite sequences you do not need to do this.

Implementation

bool writeArray(List<dynamic> value, [bool indefinite = false, int? length]) {
  // Mark the output buffer, if we cannot encode
  // the whole array structure rewind so as to perform
  // no encoding.
  var res = true;
  _out.mark();
  final ok = _writeArrayImpl(value, indefinite, length);
  if (!ok) {
    _out.resetToMark();
    res = false;
  }
  _builderHookImpl(false);
  return res;
}