canBeDeserialized static method

bool canBeDeserialized(
  1. String data
)

Implementation

static bool canBeDeserialized(String data) {
  final decodedData = jsonDecode(data);

  assert(decodedData is List);

  if (decodedData[0] != NostrConstants.count) {
    return false;
  }

  final countMap = decodedData[2];
  if (countMap is Map<String, dynamic>) {
    return countMap
        .map((key, value) => MapEntry(key.toUpperCase(), value))
        .containsKey(NostrConstants.count);
  } else {
    return false;
  }
}