假设我有一个
我收到了以下错误信息:
SingleChildScrollView
,它的内容从文件中读取:singleChildScrollView(
padding: EdgeInsets.all(8.0),
child: nw Text(
getTextFromFile(), //<---read from file
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 19.0,
),
));
Future<String> getFileData(String path) async {
return await rootBundle.loadString(path);
}
Future<String> getTextFromFile() async {
return getFileData("test.txt");
}
我收到了以下错误信息:
The argument type 'Future<String>' can't be assigned to the parameter
type 'String'.
如何解决这个问题?