topicType static method

String? topicType(
  1. String topicName
)

Returns the type of topic based on topic name

Implementation

static String? topicType(String topicName) {
  if (topicName.runtimeType != String) {
    return 'xxx';
  }

  const types = {
    'me': 'me',
    'fnd': 'fnd',
    'grp': 'grp',
    'new': 'grp',
    'nch': 'grp',
    'chn': 'grp',
    'usr': 'p2p',
    'sys': 'sys',
  };

  if (topicName.length == 2) {
    return types[topicName.substring(0, 2)];
  }

  return types[topicName.substring(0, 3)];
}