When I try to execute the code below, I get an error that the file cannot be imported.
I have passed the path to flutter and dart, but do I need any other settings?It would be very helpful if you could let me know.
[Code]
import 'package:flutter/material.dart';
void main() = > runApp(MyApp());
class MyApp extensions StatelessWidget {
@override
Widget build (BuildContext context) {
US>return MaterialApp(
title: 'Welcome to Flutter',
home —Scaffold(
appBar —AppBar(
title:Text('Welcome to Flutter'),
),
body: Center(
child:Text('Hello World'),
),
),
);
}
}
[Error Contents]
Error: Could not resolve the package 'flutter' in 'package:flutter/material.dart'.
main.dart:1:8:Error: Not found: 'package:flutter/material.dart'
import 'package:flutter/material.dart';
^
main.dart:7:16:Error: Type 'BuildContext' not found.
Widget build (BuildContext context) {
^^^^^^^^^^^^
main.dart:7:3:Error: Type 'Widget' not found.
Widget build (BuildContext context) {
^^^^^^
main.dart:5:21:Error: Type 'StatelessWidget' not found.
class MyApp extensions StatelessWidget {
^^^^^^^^^^^^^^^
main.dart:3:16:Error: Method not found: 'runApp'.
void main() = > runApp(MyApp());
^^^^^^
main.dart:7:16:Error: 'BuildContext' isn't a type.
Widget build (BuildContext context) {
^^^^^^^^^^^^
main.dart:12:18:Error: Method not found: 'Text'.
title:Text('Welcome to Flutter'),
^^^^
main.dart:11:17:Error:Method not found: 'AppBar'.
appBar —AppBar(
^^^^^^
main.dart:15:18:Error: Method not found: 'Text'.
child:Text('Hello World'),
I received a solution proposal via teratail.
https://teratail.com/questions/182461
flutter packages get
Resolved by rerunning
Note: Flutter Official Documentation
https://flutter.dev/docs/development/packages-and-packing-packing #packing
576 Who developed the "avformat-59.dll" that comes with FFmpeg?
623 Uncaught (inpromise) Error on Electron: An object could not be cloned
922 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
573 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.