0%

Flutter(Dart) Base64编解码

Flutter(Dart) Base64编解码转换(UTF8):

首先需要:

1
import 'dart:convert';

Base64编码:

1
String encoded = base64.encode(utf8.encode("input"));

Base64解码:

1
String decoded = utf8.decode(base64.decode("aW5wdXQ="));

Base64Url编码:

1
String encoded = base64Url.encode(utf8.encode("input"));

Base64Url解码:

1
String decoded = utf8.decode(base64Url.decode("aW5wdXQ="));