getProfileId method

String getProfileId(
  1. String profileName,
  2. String link
)

Implementation

String getProfileId(String profileName, String link) {
  var matches = profiles[profileName] ?? [];
  var trimmed = trim(link);
  var idx = findIndexFromLink(matches, trimmed, config);
  if (idx == -1) {
    throw AppException("Link has not matched with profile $profileName");
  }
  var match = createRegexp(matches[idx], config).firstMatch(trimmed);

  var response = match?.group(matches[idx].group);
  if (response == null) {
    throw AppException("There was no successful matching for $profileName");
  }
  return response;
}