I’m aware that I can’t import it like other core libraries:
#import('dart:unittest');
I saw in the unit test article that they include it:
#import('DART_SDK_PATH/lib/unittest/unittest.dart');
So I gave this a try with:
#import('C:/Users/Phlox/Documents/dart/dart-sdk/lib/unittest/unittest.dart');
No luck. I also tried the relative path without luck. I only received the error: ‘Cannot find referenced source: C:/Users/Phlox/Documents/dart/dart-sdk/lib/unittest/unittest.dart’. I then came across some threads that mention:
pubspec.yaml (added to same folder as your main dart file)
dependencies:
unittest:
sdk: unittest
installing packages
pub install –sdkdir=”/path/to/dart-sdk”
importing
#import("package:unittest/unittest.dart");
but this was followed by the the news
It looks like this will only work on platforms with symlinks (i.e. not
Windows, by default).
Is there something I haven’t tried that might work?
If this is is a test running directly in the web browser (rather than on the command line), then try importing directly from the hosted source: