Вопрос

I'm starting to get into Dart but I'm having trouble with compiling it.

I have 2 files:
Main.dart
TurtleDart.dart

Main.dart houses my void main() and imports TurtleDart.dart. At this point, TurtleDart.dart only houses an empty class with a constructor.

When compiling Main.dart it all goes fine... I think (I'm getting a 400 line JS file), however when compiling TurtleDart.dart, I get the following error:

TurtleDart.dart:
Error: Could not find 'main'.

Error: Compilation failed.

I know why the error comes forth, but I don't want to implement void main() into this file, because I want to use this as a class file.

My logic is that I want to call Main.dart to initialize a new TurtleDart instance, which handles everything else.

How can I manage this?

I'm using PHPStorm 7.1.3 with the Dart plugin.

Это было полезно?

Решение

dart2js will compile all needed libraries and files automatically. Generating your "main"-file will create the javascript code with all required files. So no need to compile each file separately.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top