Base64.decode throws FormatException Invalid length, must be multiple of four #39510
Labels
area-core-library
SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.
library-convert
type-enhancement
A request for a change that isn't a bug
Issue with dart:convert
base64.decode
orbase64Url.decode
throws a FormatException('Invalid length, must be multiple of four") when decoding the following base64 encoded string"eyJlbWFpbCI6ImFnb2xhcnVAZ21haWwuY29tIiwibmFtZSI6IkFkcmlhbiBPbGFydSIsInRva2VuIjoiS3FBd2J2M3A0cVZVM3V1Mzg4Z3dqQUVMIiwidXNlcm5hbWUiOiJhZHJpYW5fb2xhcnUiLCJpZCI6NDAyNjIsInJvbGUiOiJ1c2VyIn0"
.It works just fine in JavaScript env using
atob
.To make it work I had to normalize it first using
base64.normalize
.We can close this if it's ok to normalize it explicitly I was just expecting it to work directly using
base64.decode
method.Dart VM version: 2.6.0 (Thu Oct 24 17:52:22 2019 +0200) on "macos_x64"
The text was updated successfully, but these errors were encountered: