Skip to content

wx.chooseMedia返回数据出错 #3

@hashdogcn

Description

@hashdogcn

版本:
mpflutter_wechat_api: ^2.2.2
代码:
wx.chooseMedia(ChooseMediaOption()
// ..mediaType = ['image']
..sourceType = ['album', 'camera']
..sizeType = ['original', 'compressed']
..count = 1
..success = (res) async {
final tempMediaFile = res.tempFiles.first;
onSuccess.call(File(tempMediaFile.tempFilePath),
File(tempMediaFile.thumbTempFilePath));
}
..fail = (err) {
LogUtil.e(err.errMsg);
onFail.call();
});
报错信息:
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type '_Map<String, dynamic>' is not a subtype of type 'JSObject?'
#0 ChooseMediaSuccessCallbackResult.tempFiles. (package:mpflutter_wechat_api/mpflutter_wechat_api.dart:5851:45)
#1 MappedListIterable.elementAt (dart:_internal/iterable.dart:425:31)
#2 ListIterator.moveNext (dart:_internal/iterable.dart:354:26)
#3 new _GrowableList._ofEfficientLengthIterable (dart:core-patch/growable_array.dart:189:27)
#4 new _GrowableList.of (dart:core-patch/growable_array.dart:150:28)
#5 new List.of (dart:core-patch/array_patch.dart:39:18)
#6 ListIterable.toList (dart:_internal/iterable.dart:224:7)
#7 ChooseMediaSuccessCallbackResult.tempFiles (package:mpflutter_wechat_api/mpflutter_wechat_api.dart:5852:10)
#8 WxUtil.showWxImagePicker. (package:xxxxxxx/utils/wx_util.dart:94:35)
#9 ChooseMediaOption.success=. (package:mpflutter_wechat_api/mpflutter_wechat_api.dart:5830:14)
#10 Context._installFunctionCallbackListenner. (package:mpflutter_core/mpjs/mpjs_dev_impl.dart:28:26)
#11 new DevMPJSHost. (package:mpflutter_core/dev_app/dev_mpjs_host.dart:31:29)
#12 IsolateDevServer.start (package:mpflutter_core/dev_app/dev_server.dart:104:29)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions