我刚开始应用程序编写,我找到了一个教程,这个函数在这里工作,但在我的例子中它不能。我得到了一个错误:“类型'Account‘的A值不能分配给’Response‘类型的变量。”
Future _getAccount()async{
try{
Response<dynamic> res = await account.get();//A value of type 'Account' can't be assigned to a variable of type 'Response<dynamic>'.
return User.fromJson(res.data);
}catch(e){
throw(e);
}}
有什么想法吗?谢谢
发布于 2022-09-27 03:23:04
你可能在看一个过时的教程。account.get()不再像错误提示的那样返回Response。请尝试:
import 'package:appwrite/appwrite.dart'
Future<models.Account> _getAccount()async{
try{
models.Account res = await account.get();
return res;
} catch(e){
rethrow;
}https://stackoverflow.com/questions/73784153
复制相似问题