![](/img/trans.png)
[英]After Flutter upgrade: The argument type 'Future<bool> Function(File)' can't be assigned to the parameter type 'FutureOr<dynamic> Function(Uint8List)'
[英]How to solve The argument type 'Future<File> Function(Map<String, dynamic>)' can't be assigned to the parameter type 'FutureOr<File> in Flutter
我是飛鏢/顫振的新手,幾周以來一直遇到問題
參數類型“Future Function(Map<String, dynamic>)”不能分配給參數類型“FutureOr Function(Map<String, dynamic>,
如何解決? 我的代碼是
File _file =
await Executor().execute(fun1: _writeFileToDiskIsolated, arg1: data);
_gotImage = _file;
}
return _gotImage;
}
static Future<File> _writeFileToDiskIsolated(
Map<String, dynamic> data) async {
File _theFile = File(data['path'] + 'imagetest');
_theFile.writeAsBytes(data['response']);
return _theFile;
}
這是帶有紅線的編輯器問題的快照
只需將Future
替換為FutureOr
static FutureOr<File> _writeFileToDiskIsolated(
Map<String, dynamic> data) async {
File _theFile = File(data['path'] + 'imagetest');
_theFile.writeAsBytes(data['response']);
return _theFile;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.