我开始学习颤振并设置所有设置和其他内容。但是,当我在VS Code或Android Studio中启动项目时,出现此错误“连接服务协议时出错:HttpException:在接收到完整标头之前,连接已关闭,uri = http://127.0.0.1:60944/JpB2Y6E0g_g=/ws”,并且应用程序未启动,但是当我进入终端并说“ flutter run”,那么我仍然会遇到这个错误,但是应用程序启动了。但是,我无法直接运行应用程序,并且不能使用“ HOT-RELOAD”
我尝试清除频闪且关闭的防御程序或我拥有的任何防病毒程序以及Internet上的某些内容,但其中任何一个都无法帮助我
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Anasayfa'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.display1,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
我不能直接在终端ı上直接运行项目,而要在IDE上运行应用程序并使用“热重载”