String base64Trim(String value) { while (value.isNotEmpty && value[value.length - 1] == '=') { final len = value.length; value = value.substring(0, len - 1); } return value; }