Flutter 使用onTab()时出现颤振错误
这是错误消息Flutter 使用onTab()时出现颤振错误,flutter,Flutter,这是错误消息 compiler message: Unhandled exception: Crash when compiling file:///C:/Users/Anton/AndroidStudioProjects /kontaktdaten_app/lib/Pages/landingPage.dart, at character offset 136: lib/Pages/landingPage.dart:9:16: Internal problem: Unhan
compiler message: Unhandled exception:
Crash when compiling file:///C:/Users/Anton/AndroidStudioProjects /kontaktdaten_app/lib/Pages/landingPage.dart,
at character offset 136:
lib/Pages/landingPage.dart:9:16: Internal problem: Unhandled () → void => dart.core::print("Tapped") in defaultTreeNode.
onTap: () => print("Tapped"),
这是我的密码
import 'package:flutter/material.dart';
class LandingPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new Material(
color: Colors.blueAccent,
child: InkWell(
onTap: () => print("Tapped"),
child: new Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Text("Tap to Start!", style: new TextStyle(color: Colors.white, fontSize: 50.0)),
],
),
)
);
}
}
导入“包装:颤振/材料.省道”;
类LandingPage扩展了无状态小部件{
@凌驾
小部件构建(构建上下文){
退回新材料(
颜色:Colors.blueAccent,
孩子:InkWell(
onTap:()=>打印(“点击”),
子:新列(
mainAxisAlignment:mainAxisAlignment.center,
儿童:[
新文本(“点击开始!”,样式:新文本样式(颜色:Colors.white,fontSize:50.0)),
],
),
)
);
}
}
我将颤振更新为最新版本,但它没有发出声音。因此,请帮助我:在我上周构建的一个旧项目中,onTab()函数可以正常工作。您的最新版本是什么<代码>颤振——版本0.2.8,但我用相同的代码构建了一个新项目,现在它可以工作了。我不知道为什么它现在可以工作尝试清除旧项目的构建目录(flutter clean)并重建-它可能缓存了导致问题的以前构建中的某些内容。