Working on a flutter project I'm in the very early stages of the project and I am getting this massive error when I try to run the project
Launching lib/main.dart on iPhone 14 in debug mode...
main.dart:1
Xcode build done. 8.2s
[VERBOSE-2:FlutterDarwinContextMetalImpeller.mm(37)] Using the Impeller rendering backend.
[VERBOSE-2:dart_isolate.cc(144)] Could not prepare isolate.
[VERBOSE-2:runtime_controller.cc(436)] Could not create root isolate.
[VERBOSE-2:shell.cc(637)] Could not launch engine with configuration.
Exited
is what the debug console and terminal give me whenever I try to run, right before this I had just set up my main.dart
import 'package:flutter/material.dart';
class HomePage extends StatefulWidget {
const HomePage({super.key});
@override
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
void addNewExpense() {}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey[300],
floatingActionButton: FloatingActionButton(
onPressed: addNewExpense,
child: Icon(Icons.add),
),
);
}
}
I already ran Flutter Doctor and couldn't find a problem, Here's the log:
[✓] Flutter (Channel stable, 3.13.0, on macOS 13.0.1 22A400 darwin-arm64, locale en-US)
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] VS Code (version 1.77.1)
[✓] Connected device (3 available)
[✓] Network resources
! Doctor found issues in 2 categories.
I also ran flutter clean
and then flutter pub get
I even closed and reopened VScode.
Any help is appreciated, I'm a complete noob to flutter and programing in geral
I inspected your code & I found that you missed the two most important functions to write. which are main() & runApp().
So, here I wrote the whole thing for you. Just paste this code into your main.dart
file & you're good to go.
import "package:flutter/material.dart";
void main() {
WidgetsFlutterBinding.ensureInitialized();
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: "Flutter Demo",
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const HomePage(),
);
}
}
class HomePage extends StatefulWidget {
const HomePage({super.key});
@override
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
void addNewExpense() {}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey[300],
floatingActionButton: FloatingActionButton(
onPressed: addNewExpense,
child: const Icon(Icons.add),
),
);
}
}