decodeWithInfo static method
Implementation
static B64DecodingInfo decodeWithInfo(
String data, {
bool validatePadding = true,
bool urlSafe = true,
}) {
bool isPaded = data.length % 4 == 0;
bool isUrlSafe = data.contains('-') || data.contains('_');
if (isUrlSafe && !urlSafe) {
throw B64ConverterException();
}
if (validatePadding && !isPaded) {
throw B64ConverterException();
} else if (!validatePadding) {
while (data.length % 4 != 0) {
data += '=';
}
}
if (isUrlSafe) {
data = data.replaceAll('-', '+').replaceAll('_', '/');
}
final encoder = _Base64StreamDecoder();
try {
encoder.add(data);
return B64DecodingInfo(
isUrlSafe: isUrlSafe,
isPaded: isPaded,
data: encoder.finalize().clone(),
);
} finally {
encoder.clean();
}
}