Open 50n13x opened 2 years ago
FYI, with the following quick fix it seems to work:
flutter_media_metadata_web.dart: line 109 -113:
final metadata = <String, dynamic>{
'metadata': {},
'albumArt': base64Decode(rawMetadataJson['Cover_Data']),
'filePath': null,
};
replaced by:
var metadata = <String, dynamic>{};
if (rawMetadataJson['Cover_Data'] != null) {
metadata = <String, dynamic>{
'metadata': {},
'albumArt': base64Decode(rawMetadataJson['Cover_Data']),
'filePath': null,
};
} else {
metadata = <String, dynamic>{
'metadata': {},
'albumArt': null,
'filePath': null,
};
}
Haven't yet checked if an album art is derived it the file contains one.
It's right and I have the same issue.
Error: Expected a value of type 'String', but got one of type 'Null'
dart-sdk/lib/_internal/js_dev_runtime/private/ddcruntime/errors.dart 266:49 throw
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 99:3 castError
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 452:10 cast
dart-sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart 705:17 as
packages/flutter_media_metadata/src/flutter_media_metadata_web.dart 111:31
Hi,
Following piece of code:
[...]
I checked this with mp3, m4a and wmv files. It only occurs on Flutter web. If the audio files contain an album art everything works fine. If they do not contain an album art, I get the following error message:
Error: Expected a value of type 'String', but got one of type 'Null' at Object.throw_ [as throw] (http://localhost:50323/dart_sdk.js:5067:11) at Object.castError (http://localhost:50323/dart_sdk.js:5026:15) at Object.cast [as as] (http://localhost:50323/dart_sdk.js:5351:17) at Function.as (http://localhost:50323/dart_sdk.js:46170:19) at http://localhost:50323/packages/flutter_media_metadata/src/flutter_media_metadata_web.dart.lib.js:89:159 at Object._checkAndCall (http://localhost:50323/dart_sdk.js:5274:16) at Object.dcall (http://localhost:50323/dart_sdk.js:5279:17) at ret (http://localhost:50323/dart_sdk.js:62346:21)
Afaik this relates to the following line of code:
let metadata = new (T.IdentityMapOfString$dynamic()).from(["metadata", new _js_helper.LinkedMap.new(), "albumArt", convert.base64Decode(core.String.as(dart.dsend(rawMetadataJson, '_get', ["Cover_Data"]))), "filePath", null]);
I cannot read nor write .js :) but it looks like a null check is missing?
What else do you need?
Thanks, Michael