[英]No Directionality widget found. RichText widgets require a Directionality widget ancestor
I am trying to run the simplest possible flutter app by printing Hello World in the screen. 我正在尝试通过在屏幕上打印Hello World来运行最简单的flutter应用程序。
Following this issue , I tried both of the snippets : 在此问题之后 ,我尝试了两个片段:
void main() {
runApp(
new Center(
child: new Text("Hello World!", textDirection: TextDirection.ltr)
)
);
}
&& &&
void main() {
runApp(new Center(
child: new Directionality(
textDirection: TextDirection.ltr,
child: new Text('Hello, world!'))));
}
But I get error which says : 但是我收到错误提示:
No Directionality widget found.
找不到方向性小部件。 RichText widgets require a Directionality widget ancestor.
RichText小部件需要Directionality小部件祖先。
What am I missing? 我想念什么?
It worked for me after : 它对我有用:
Full Restart 完全重启
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.