update method

  1. @override
Future<void> update(
  1. String topic, {
  2. int? expiry,
  3. bool? active,
  4. PairingMetadata? metadata,
})
override

Implementation

@override
Future<void> update(
  String topic, {
  int? expiry,
  bool? active,
  PairingMetadata? metadata,
}) async {
  checkInitialized();

  PairingInfo? info = get(topic);
  if (info == null) {
    return;
  }
  // int prevExpiry = info.expiry;
  // bool wasActive = info.active;

  if (expiry != null) {
    info.expiry = expiry;
  }
  if (active != null) {
    info.active = active;
  }
  if (metadata != null) {
    info.peerMetadata = metadata;
  }

  // onUpdate.broadcast(
  //   StoreUpdateEvent(
  //     topic,
  //     info,
  //   ),
  // );

  // print('Previous expiry: $prevExpiry, new expiry: ${info.expiry}');
  // print('Previous active: $wasActive, new active: ${info.active}');
  await set(topic, info);

  // print('Saved PairingInfo');
  // print(get(topic));
}