deserializeDbRelaySet function

  1. @isarProtected
DbRelaySet deserializeDbRelaySet(
  1. IsarReader reader
)

Implementation

@isarProtected
DbRelaySet deserializeDbRelaySet(IsarReader reader) {
  final String _name;
  _name = IsarCore.readString(reader, 2) ?? '';
  final String _pubKey;
  _pubKey = IsarCore.readString(reader, 3) ?? '';
  final RelayDirection _direction;
  {
    if (IsarCore.readNull(reader, 4)) {
      _direction = RelayDirection.inbox;
    } else {
      _direction = _dbRelaySetDirection[IsarCore.readByte(reader, 4)] ??
          RelayDirection.inbox;
    }
  }
  final int _relayMinCountPerPubkey;
  _relayMinCountPerPubkey = IsarCore.readLong(reader, 5);
  final List<DbRelaySetItem> _items;
  {
    final length = IsarCore.readList(reader, 6, IsarCore.readerPtrPtr);
    {
      final reader = IsarCore.readerPtr;
      if (reader.isNull) {
        _items = const <DbRelaySetItem>[];
      } else {
        final list = List<DbRelaySetItem>.filled(
            length,
            DbRelaySetItem(
              '',
              const <DbPubkeyMapping>[],
            ),
            growable: true);
        for (var i = 0; i < length; i++) {
          {
            final objectReader = IsarCore.readObject(reader, i);
            if (objectReader.isNull) {
              list[i] = DbRelaySetItem(
                '',
                const <DbPubkeyMapping>[],
              );
            } else {
              final embedded = deserializeDbRelaySetItem(objectReader);
              IsarCore.freeReader(objectReader);
              list[i] = embedded;
            }
          }
        }
        IsarCore.freeReader(reader);
        _items = list;
      }
    }
  }
  final object = DbRelaySet(
    name: _name,
    pubKey: _pubKey,
    direction: _direction,
    relayMinCountPerPubkey: _relayMinCountPerPubkey,
    items: _items,
  );
  return object;
}