提交缺失语言文件

This commit is contained in:
wyf
2026-01-31 14:44:55 +08:00
parent 97ffc1220d
commit 144de2c965
5 changed files with 1038 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
import 'dart:convert';
class Base64Tool {
/// 编码为 URL 安全的 Base64网络请求用这个就够了
static String encode(String text) {
final base64Str = base64.encode(utf8.encode(text));
return base64Str
.replaceAll('+', '-')
.replaceAll('/', '_')
.replaceAll('=', '');
}
/// 解码 URL 安全的 Base64
static String decode(String urlSafeBase64) {
var base64Str = urlSafeBase64.replaceAll('-', '+').replaceAll('_', '/');
// 补充等号
while (base64Str.length % 4 != 0) {
base64Str += '=';
}
return utf8.decode(base64.decode(base64Str));
}
}