getIssuer function

Future<String> getIssuer(
  1. String textUrl
)

Get POD issuer URI

Implementation

Future<String> getIssuer(String textUrl) async {
  String _issuerUri = '';
  if (textUrl.contains('profile/card#me')) {
    String pubProf = await fetchProfileData(textUrl);
    _issuerUri = getIssuerUri(pubProf);
  }

  if (_issuerUri == '') {
    /// This reg expression works with localhost and other urls
    RegExp exp = RegExp(r'(?:(?:https?|ftp):\/\/)?[\w/\-?=%.]+(\.|\:)[\w\.]+');
    Iterable<RegExpMatch> matches = exp.allMatches(textUrl);
    matches.forEach((match) {
      _issuerUri = textUrl.substring(match.start, match.end);
    });
  }
  return _issuerUri;
}