fromBase64 method
Decodes the string from Base64 encoding and returns the resulting string.
If decoding fails, the method returns a default value.
def
is the default value returned in case of a decoding error.
Returns the decoded string if successful; otherwise, returns def
.
Implementation
String fromBase64({String def = ''}) {
try {
List<int> bytes = base64.decode(this);
return utf8.decode(bytes);
} catch (e) {
return def;
}
}