encodeObject function

Pair<Pointer<Uint8>, int>? encodeObject(
  1. Object? object
)

Implementation

Pair<Pointer<Uint8>, int>? encodeObject(Object? object) {
  var encodeByteData = const StandardMessageCodec().encodeMessage(object);
  if (encodeByteData != null) {
    var length = encodeByteData.lengthInBytes;
    final result = malloc<Uint8>(length);
    final nativeParams = result.asTypedList(length);
    nativeParams.setRange(0, length, encodeByteData.buffer.asUint8List());
    return Pair(result, nativeParams.length);
  }
  return null;
}