enter image description here
Facing this error while installing new packages and also while running commands
Facing this error while installing new packages and also while running commands.
I tried upgrading Flutter and Dart but the issue is still not solved.
I’m a beginner in flutter and do not have much knowledge about it.
I want you to see the error in pictures and help me in sorting out the problem!
Here is the code:
import 'package:flutter/material.dart';
void main() {
runApp(MyApp(), );
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(debugShowCheckedModeBanner
: false, title
: 'Flutter Demo',
// theme: ThemeData(
// primarySwatch: Colors.blue,
// ),
home
: MyHomePage(), );
}
}
class MyHomePage extends StatelessWidget {
var nameController = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Shared Preferences'),
),
body: Container(
child: Column(
children: [
TextField(
controller: nameController,
decoration: InputDecoration(
label: Text('Name'),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(21),
),
),
),
SizedBox(
height: 11,
),
OutlinedButton(
onPressed: () {
var name = nameController.text.toString();
child: Text('Save'),),
],
),
),
);
}
}
irfan sadat is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.