writeMap method

bool writeMap(
  1. Map value, [
  2. bool indefinite = false,
  3. int? length
])
inherited

Map primitive. Valid map keys are integer and string. RFC7049 recommends keys be of a single type, we are more generous here. Valid map values are integer, string, bool, float(any size), array map or buffer. Returns true if the encoding has been successful.

Implementation

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