fromText static method
Implementation
static Principal fromText(String text) {
try {
final canisterIdNoDash = text.toLowerCase().replaceAll('-', '');
var arr = base32Decode(canisterIdNoDash);
arr = arr.sublist(4, arr.length);
final principal = Principal(arr);
if (principal.toText() != text) {
throw 'Principal "${principal.toText()}" does not have a valid checksum.';
}
return principal;
} catch (e) {
rethrow;
}
}