Pergunta

I have a folder structure that looks like this:

- /dart_demo
  - main.dart
  - pubspec.yaml
- /core
  - core.dart
  - pubspec.yaml

dart_demo is my entry point app, its pubspec looks like this:

name: dart_demo
dependencies:
  core:
    path: ../core/

the core library's pubspec is this:

name: core
version: 0.0.1
description: >
  My core library.
dependencies:
  xml: ">=2.0.0 <3.0.0"
  browser: ">=0.10.0+2 <0.11.0"

when i run pub get inside dart_demo, it creates a packages folder with the dependencies needed by my core package, such as xml. but my own core package is not symlinked in my dart_demo packages folder.

how can i get the references to my core classes?

Foi útil?

Solução

Im not sure if this is the basic cause of the problem but to be able to import a package the package must have something inside its lib directory.

You should move your main.dart into the subfolder bin of your dart_demo package if it is a command line application or web if its code for a web page.

You should move your core.dart file into the subfolder lib of your core package.

If it still doesn't work pleas add a comment.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top