Flutter Could not prepare to run the isolate

  1. please check whether your Flutter Project containsmain.dart in lib folder, if not, create it.

  2. check your code like this:

import 'package:flutter/material.dart';
import 'package:module_flutter/xxxApp.dart';

void main() => runApp( new xxxApp());

If you are facing the problem even if you have main method in main.dart inside your lib folder

Try

flutter clean

And then

flutter run

Worked for me :)


I had the same error and it happened when I didn't write the main method. so do this

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

MyApp is my main class