toProfiles static method

List<Profile> toProfiles(
  1. List<List<String>> tags
)

Returns profiles from event.tags

List<List<String>> tags = [
  ["p", "91cf9..4e5ca", "wss://alicerelay.com/", "alice"],
  ["p", "14aeb..8dad4", "wss://bobrelay.com/nostr", "bob"],
  ["p", "612ae..e610f", "ws://carolrelay.com/ws", "carol"]
];
List<Profile> profiles = Nip2.toProfiles(tags);

Implementation

static List<Profile> toProfiles(List<List<String>> tags) {
  List<Profile> result = [];
  for (var tag in tags) {
    if (tag[0] == "p") result.add(Profile(tag[1], tag[2], tag[3]));
  }
  return result;
}