我正在看下面的視頻,他們..在 initState() 中使用運算子


我究竟做錯了什么?
uj5u.com熱心網友回復:
我相信你有額外的供應;
void initState() {
super.initState();
// select where the video is coming from asset/file/network
_videoPlayerController = VideoPlayerController.asset(asset)
..setListener( ()=> setState(() {})); // error: expected an identifier
..setLooping(true); // error: expected an identifier
..initialize(); // error: expected an identifier
}
uj5u.com熱心網友回復:
你;在每一行之后使用,為了使用 ..你不需要;在行尾使用,所以試試這個:
void initState() {
super.initState();
// select where the video is coming from asset/file/network
_videoPlayerController = VideoPlayerController.asset(asset)
..setListener( ()=> setState(() {}))
..setLooping(true)
..initialize();
}
uj5u.com熱心網友回復:
您可以在以下鏈接中找到您的問題:
https://stackoverflow.com/a/49447872/19122402
https://dart.dev/guides/language/language-tour#cascade-notation-
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/529376.html
標籤:扑镖
