我已经重新安装了flutter和Android Studio到我的设备,之后脚手架小部件不工作。它说"这个方法'Scaffold'不是为'MyApp'类型定义的">
add wrapScaffold与MaterialApp小部件
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Welcome to Flutter',
home: Scaffold(
appBar: AppBar(
title: const Text('Welcome to Flutter'),
),
body: const Center(
child: Text('Hello World'),
),
),
);
}
}