Skip to main content

How to configure multiple entry points in a single flutter project?

How to configure multiple entry points in a single flutter project using IntelliJ IDEA IDE?


You might have multiple dart files that serve as entry points for the same flutter project and require to alter between them. For example in the layers example project of flutter you need to run the same project with different entry points. To do this all you have to do is follow the steps mentioned below:


1. Go to the top right portion of the IDE and find the dropdown with "main.dart" in it and select it by clicking on it.

2. The drop down would expand and show "Edit Configurations" as the first item. Click on "Edit Configurations".

3. This will open up the "Run/Debug Configurations" window. Click on the + button on the top right hand corner to add new configuration.

4. This would show the "Add New Configuration" dialog. You would need to select "Flutter" from the list.

5. After this you would need to click the ellipsis button (or the button with 3 dots like so ...) next to the "Data entrypoint" caption.
 
6. This would open up a "Choose Dart File" dialog where you would need to select the appropriate dart file with a main method in it for serving as the new entry point.

7. Give an appropriate name to the new entry point by entering a name in the Name field on the top.

8. Now you can run the selected entry point from your IntelliJ IDEA IDE using the green play/ run button.

Comments