toFlexBuffer function

Uint8List toFlexBuffer(
  1. Object value
)

Serializes any FlexBuffer-compatible value to bytes.

Supported types: bool, int, double, String, List<dynamic>, Map<String, dynamic>, and nested combinations of these. List elements and map values (not keys) can be null.

Implementation

@pragma('vm:prefer-inline')
Uint8List toFlexBuffer(Object value) {
  final buffer = flex.Builder.buildFromObject(value);
  return buffer.asUint8List();
}