Versions:
Flutter 1.0.0
Dart 2.1.0
js 0.6.1
Simply importing js module through import “package:js/js.dart” is throws exception.
Compiler message:
file:///usr/local/google/home/ggovindaraj/Downloads/flutter_linux_v1.2.1-stable/flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.1+1/lib/js.dart:8:1: **Error: Not found: 'dart:js'
export 'dart:js' show allowInterop, allowInteropCaptureThis;**
^
Unhandled exception:
FileSystemException(uri=org-dartlang-untranslatable-uri:dart%%3Ajs; message=StandardFileSystem only supports file:* and data:* URIs)
#0 StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:33:7)
#1 asFileUri (package:vm/kernel_front_end.dart:544:37)
<asynchronous suspension>
#2 writeDepfile (package:vm/kernel_front_end.dart:712:21)
<asynchronous suspension>
#3 FrontendCompiler.compile (package:vm/frontend_server.dart:366:15)
<asynchronous suspension>
#4 _FlutterFrontendCompiler.compile (package:frontend_server/server.dart:31:22)
<asynchronous suspension>
#5 starter (package:frontend_server/server.dart:133:27)
<asynchronous suspension>
#6 main (file:///b/rr/tmpmr462B/w/src/flutter/frontend_server/bin/starter.dart:8:30)
<asynchronous suspension>
#7 _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:298:32)
#8 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
You can only use
package:js
on the Web where Dart compiles to JavaScript, you can’t use it in Flutter because there Dart is executed natively on the Dart VM.