isProtected method

  1. @override
bool isProtected(
  1. PeerId peerId,
  2. String tag
)
override

Returns true if the peer is protected for some tag; if the tag is the empty string then it will return true if the peer is protected for any tag

Implementation

@override
bool isProtected(PeerId peerId, String tag) {
  final protections = _protections[peerId];
  if (protections == null) {
    return false;
  }

  if (tag.isEmpty) {
    return protections.isNotEmpty;
  }

  return protections.contains(tag);
}