0

My Dart app project structure:

myapp/
    pubspec.yaml
    pubspec.lock
    asset/
        ...assets
    build/
    packages/
    web/
        lookups/
            AjaxLookups.dart
        requests/
            RESTClient.dart
            AjaxRESTClient.dart

The AjaxLookups file:

library myapp;

abstract class AjaxLookups {
    static final String BASE_URL = "/myapp";
    static final String DO_S0METHING_SERVICE_URL = BASE_URL + "/doSomething";
}

The RESTClient file:

library myapp;

typedef void Callback(String json);

abstract class RESTClient {
    void get(String url, Callback onFail, Callback onSuccess);

    void post(String url, String dataJSON, Callback onFail, Callback onSuccess);
}

The AjaxRESTClient file:

library myapp;

import "RESTClient.dart";
import "../lookups/AjaxLookups.dart";
import "dart:html";
import "dart:convert" show JSON;

class AjaxRESTClient implements RESTClient, AjaxLookups {
    // ...
}

Above, the import statement for AjaxLookups is causing a compiler error:

Target of URI does not exist: '../request/AjaxLookups.dart'

Why am I getting this? Why can't Dart find ../request/AjaxLookups.dart? What do I need to do to fix it?

halfer
  • 19,824
  • 17
  • 99
  • 186
IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756

2 Answers2

1

It looks like the file AjaxLookups.dart is in the lookups folder, so your import should be:

import "../lookups/AjaxLookups.dart";
ringstaff
  • 2,331
  • 1
  • 16
  • 25
  • Sorry @ringstaff - that was a cut-n-paste error - my import statement *did* contain "lookups" in it instead of "request" - thanks thought! – IAmYourFaja Dec 27 '13 at 15:21
0

I figured it out. I was declaring a new myapp library inside each source file. Instead I added a main/driver Dart file, declared a library in it called myapp, and then changed all the other source files to be part of myapp;.

IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756