I have a web app using polymer (not sure if the polymer aspect is relevant), and I'm trying to spawn an isolate from an external package. While I can import the package fine, using the same path in Uri.file results in an invalid uri. For example:
//packaged_app.dart library packaged_app;
main(args, message){
//do something
}
//main_app.dart
library main_app.dart;
import 'package:polymer/polymer.dart';
import 'dart:isolate';
//import 'package:packaged_app/packaged_app.dart'; (finds the correct file, but not needed)
void main(){
initPolymer();
var uri = new Uri.file('package:packaged_app/packaged_app.dart');
var rp = new ReceivePort();
Isolate.spawnUri(uri, rp.sendPort);
}
I've tried many variations on the uri, including:
- new Uri.file(path), and - new Uri(path: path)
with values of path including:
- package:packaged_app/packaged_app.dart, - packages/packaged_app/packaged_app.dart, - ../relative/path/to/packaged_app/packaged_app.dart, and - /absolute/path/to/packaged_app/packaged_app.dart
all to not avail. If I copy packaged_app.dart into the same directory as main_app.dart it runs fine, but that feels dirty.