The Dart plug-in for IntelliJ IDEA is unable to import a Dart Module in my Dart project from a folder.
If I select "Import Module.." from the File Menu, it doesn't show the *.yaml extension of a Dart module in the list of available files formats.
If I try to import any Dart Module from a folder, after selecting the .yaml file I get the following error: Cannot Import anything from /Users/.../.../pubspec.yaml
It is also impossible to import a Dart Project using the "Import Project..." option of the "File Menu", and selecting the Dart Project file (usually named: "pubspec.yaml").
The only way to load a Dart Module or a Dart Project from a disc folder is to create a new Dart project in IntelliJ IDE, edit the pubspec.yaml file and manually add a package source with the "path:" option.
For example, to add the module "Dart Web Toolkit" you need to edit the yaml file in this way:
name: untitled1
dependencies:
browser: any
dart_web_toolkit:
path: /Users/Emanuele/Documents/DART Projects/Dart Web Toolkit
And then you need to select the "Dart Get Dependencies" option from the contextual menu to import it.
Also this method does not add a new module or a new project, but only add the module as a "dependency".
There is no way to directly import a Dart module and automatically create a new Dart Project with it.
Note that this is also true if the module or the project is not a local folder but it is hosted on a Git repository. There is no way to add a Dart module or a Dart project, you need to create a new project, and manually edit the yaml file adding the url to the dependencies section, like this:
name: untitled1
dependencies:
browser: any
dart_web_toolkit:
git:
url: git://github.com/akserg/dart_web_toolkit
ref: master
Proposed Solution:
- Allow to import a Dart Module or a Dart Project from a folder, supporting the *.yaml file format in the "Import Module" or in the "Import Project" options of the File Menu
- Allow to import a Dart Module or a Dart Project from a Git repository url, adding a "Import Module from Git" and a "Import Project from Git" option in the File Menu
- Allow to add a Dart Module to an existing Dart project as a dependency selecting the correspondent *.yaml file from a folder or the Git repository url.
Thank you.