Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter complains that it "Could not prepare isolate"

The error looks like this:

E/flutter ( 3378): [ERROR:flutter/runtime/dart_isolate.cc(144)] Could not prepare isolate.
E/flutter ( 3378): [ERROR:flutter/runtime/runtime_controller.cc(422)] Could not create root isolate.
E/flutter ( 3378): [ERROR:flutter/shell/common/shell.cc(609)] Could not launch engine with configuration.

I am getting this error when I use StatefulWidget and StatelessWidgets. I don't get these errors when I write code without using them.

How can I fix this error?

like image 976
Alisher Avatar asked Oct 15 '25 08:10

Alisher


2 Answers

I had this error before because I forgot to use the runApp(MyApp()) in void main

like image 192
Arash shirali Avatar answered Oct 17 '25 02:10

Arash shirali


I know this is old but I'm answering for the record for if someone is having this issue.

You probably just forgot to write the main method in main.dart Just add:

void main() => runApp(const MyApp());

before the class.

like image 42
TheAtef Avatar answered Oct 17 '25 01:10

TheAtef