subscribeRoomAccountDataStream method

Stream<bool> subscribeRoomAccountDataStream(
  1. String room,
  2. String key
)

listen to account data updates of specific room

Implementation

Stream<bool> subscribeRoomAccountDataStream(String room, String key) {
  final tmp1 = room;
  final tmp5 = key;
  var tmp0 = 0;
  var tmp2 = 0;
  var tmp3 = 0;
  var tmp4 = 0;
  var tmp6 = 0;
  var tmp7 = 0;
  var tmp8 = 0;
  tmp0 = _box.borrow();
  final tmp1_0 = utf8.encode(tmp1);
  tmp3 = tmp1_0.length;

  final ffi.Pointer<ffi.Uint8> tmp2_0 = _api.__allocate(tmp3 * 1, 1);
  final Uint8List tmp2_1 = tmp2_0.asTypedList(tmp3);
  tmp2_1.setAll(0, tmp1_0);
  tmp2 = tmp2_0.address;
  tmp4 = tmp3;
  final tmp5_0 = utf8.encode(tmp5);
  tmp7 = tmp5_0.length;

  final ffi.Pointer<ffi.Uint8> tmp6_0 = _api.__allocate(tmp7 * 1, 1);
  final Uint8List tmp6_1 = tmp6_0.asTypedList(tmp7);
  tmp6_1.setAll(0, tmp5_0);
  tmp6 = tmp6_0.address;
  tmp8 = tmp7;
  final tmp9 = _api._clientSubscribeRoomAccountDataStream(
    tmp0,
    tmp2,
    tmp3,
    tmp4,
    tmp6,
    tmp7,
    tmp8,
  );
  final tmp11 = tmp9.arg0;
  final tmp12 = tmp9.arg1;
  final tmp13 = tmp9.arg2;
  final tmp14 = tmp9.arg3;
  final tmp15 = tmp9.arg4;
  if (tmp11 == 0) {
    debugAllocation("handle error", tmp12, tmp13);
    final ffi.Pointer<ffi.Uint8> tmp12_0 = ffi.Pointer.fromAddress(tmp12);
    final tmp11_0 = utf8.decode(
      tmp12_0.asTypedList(tmp13),
      allowMalformed: true,
    );
    if (tmp13 > 0) {
      final ffi.Pointer<ffi.Void> tmp12_0;
      tmp12_0 = ffi.Pointer.fromAddress(tmp12);
      _api.__deallocate(tmp12_0, tmp14, 1);
    }
    throw tmp11_0;
  }
  final ffi.Pointer<ffi.Void> tmp15_0 = ffi.Pointer.fromAddress(tmp15);
  final tmp15_1 = _Box(
    _api,
    tmp15_0,
    "__Client_subscribe_room_account_data_stream_stream_drop",
  );
  tmp15_1._finalizer = _api._registerFinalizer(tmp15_1);
  final tmp10 = _nativeStream(
    tmp15_1,
    _api.__clientSubscribeRoomAccountDataStreamStreamPoll,
  );
  return tmp10;
}