fork download
  1. import 'dart:convert';
  2. import 'dart:typed_data'; // For Uint8List
  3.  
  4. void main() {
  5. final String encodedString = "rmMinHb0nBEDsewjQ7sb6CDJSykZN/+K01v8JUwujcW5AGM536ekozYdG/xrElN4EFCCfxr0UhI4Xb/YeHwgEOYBkCVlibF/nhD6Kcvq7lx5aHe6muqRtgD81rFxkd1MY5DcQP3trafhUZwCogobE72dsZngdZj9ZkMXjfcS//YOF4G2wp4mzECJadJAC2l1P8gtUCtQNqnH9Aus7Defxhk0t1rGYpTrn70z4eIoAeyR4J5+KCFSQFzd/9jyhAgBGiw622pCPk5aLM3M6hagVoHBPuu+yfIErLW9juXFLuTj1YOUMCr+DPz+qhGqlnO3avhD0kPLopEHBjxSvDktSA==";
  6.  
  7. // Decode the Base64 string to a Uint8List (list of bytes)
  8. Uint8List decodedBytes = base64Decode(encodedString);
  9.  
  10. // Print the first few bytes (as the output is binary, full printing might be unreadable)
  11. print('Decoded bytes (first 20): ${decodedBytes.sublist(0, decodedBytes.length > 20 ? 20 : decodedBytes.length)}');
  12. print('Decoded data length: ${decodedBytes.length} bytes');
  13.  
  14. // If you want to try to interpret it as a UTF-8 string (though it's a ZIP, so it won't be readable)
  15. try {
  16. String decodedText = utf8.decode(decodedBytes);
  17. print('Attempted to decode as UTF-8 string (unlikely to be readable for ZIP): $decodedText');
  18. } catch (e) {
  19. print('Could not decode as UTF-8: $e');
  20. }
  21.  
  22. // To confirm it's a ZIP, you can check the first bytes for 'PK'
  23. if (decodedBytes.length >= 2 && decodedBytes[0] == 0x50 && decodedBytes[1] == 0x4B) {
  24. print('The decoded data appears to be a ZIP file (starts with PK).');
  25. }
  26. }
Success #stdin #stdout 1.24s 130940KB
stdin
Standard input is empty
stdout
Decoded bytes (first 20): [174, 99, 34, 156, 118, 244, 156, 17, 3, 177, 236, 35, 67, 187, 27, 232, 32, 201, 75, 41]
Decoded data length: 256 bytes
Could not decode as UTF-8: FormatException: Bad UTF-8 encoding 0xae (at offset 0)