componentSnapshot method

ComponentLifecycleSnapshot? componentSnapshot(
  1. SDKComponent component
)

Implementation

sdk_events_pb.ComponentLifecycleSnapshot? componentSnapshot(
  sdk_events_enum.SDKComponent component,
) {
  final fn = RacNative.bindings.rac_component_lifecycle_snapshot_proto;
  if (fn == null) return null;

  final out = calloc<RacProtoBuffer>();
  final bindings = RacNative.bindings;
  try {
    bindings.rac_proto_buffer_init(out);
    final code = fn(component.value, out);
    if (code != RacResultCode.success ||
        out.ref.status != RacResultCode.success) {
      _logger.debug(
        'rac_component_lifecycle_snapshot_proto failed: '
        '${_protoBufferError(out, code)}',
      );
      return null;
    }
    return _decodeBuffer(
      out,
      sdk_events_pb.ComponentLifecycleSnapshot.fromBuffer,
    );
  } catch (e) {
    _logger.debug('rac_component_lifecycle_snapshot_proto error: $e');
    return null;
  } finally {
    bindings.rac_proto_buffer_free(out);
    calloc.free(out);
  }
}