Dart 'SdkAnalysisContext' is not loaded - dart

I want update polymer app from version "^0.16.4" to '1.0.0-rc.5'. I have some lines in pubspec.yaml:
environment:
sdk: '>=1.12.0 <2.0.0'
dependencies:
bwu_datagrid:
git:
url: 'https://github.com/bwu-dart/bwu_datagrid'
ref: 'polymer1'
polymer: '1.0.0-rc.5'
polymer_interop: '^1.0.0-rc.3'
reflectable: '>=0.3.2 <0.3.4'
web_components: '^0.12.0'
dependency_overrides:
code_transformers: '^0.4.0'
reflectable:'^0.5.0'
redstone: '0.5.21+1'
quiver: '>=0.21.3 <0.22.0'
analyzer:'0.27.1'
polymer:'^1.0.0-rc.5'
args: '>=0.12.1 <0.14.0'
But when I run pub get, I get errors:
Error on line 24, column 5 of ../../../.pub-cache/hosted/10.10.3.91%588080/initialize-0.6.1+2/pubspec.yaml: Error loading transformer: 'package:code_transformers/src/dart_sdk.dart': malformed type: line 128 pos 39: type 'SdkAnalysisContext' is not loaded
final AnalysisContext context = new SdkAnalysisContext();
^
type error.
$include: '**/*_test.dart'
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error on line 23, column 5 of ../../../.pub-cache/hosted/10.10.3.91%588080/polymer_interop-1.0.0-rc.7/pubspec.yaml: Error loading transformer: 'package:code_transformers/src/dart_sdk.dart': malformed type: line 128 pos 39: type 'SdkAnalysisContext' is not loaded
final AnalysisContext context = new SdkAnalysisContext();
^
type error.
$include: test/**_test{.*,}.html
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error on line 26, column 5 of ../../../.pub-cache/hosted/10.10.3.91%588080/web_components-0.12.0+4/pubspec.yaml: Error loading transformer: 'package:code_transformers/src/dart_sdk.dart': malformed type: line 128 pos 39: type 'SdkAnalysisContext' is not loaded
final AnalysisContext context = new SdkAnalysisContext();
^
type error.
$include: '**/*_test.html'
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error on line 19, column 3 of ../../../.pub-cache/hosted/10.10.3.91%588080/polymer-1.0.0-rc.5/pubspec.yaml: Error loading transformer: 'package:code_transformers/src/dart_sdk.dart': malformed type: line 128 pos 39: type 'SdkAnalysisContext' is not loaded
final AnalysisContext context = new SdkAnalysisContext();
^
type error.
- web_components
dart --version
Dart VM version: 1.13.2 (Tue Jan 5 06:49:57 2016) on "linux_x64"
pub --version
Pub 1.13.2
Maybe some advice on how it can be solved?
transformer section in pubspec.yaml:
transformers:
- polymer:
entry_points:
- web/index.html
- $dart2js:
minify: true
commandLineOptions:
- --trust-type-annotations
- --trust-primitives
- --enable-experimental-mirrors
pub serve print that:
[Info from Reflectable on web_tt_client|web/index.bootstrap.initialize.dart]:
Ignoring entry point that does not include the class `Reflectable`.
Build completed successfully
and in dartium console:
Uncaught Unhandled exception:
Bad state: Reflectable has not been initialized. Did you forget to add the main file to the reflectable transformer's entry_points in pubspec.yaml?
spa.dart file:
library spa;
import 'package:polymer/polymer.dart';
import 'package:web_tt_client/routers/routers.dart';
//Components
import 'package:web_tt_client/components/page_view/page_view.dart';
main() async {
await initPolymer();
await prepareViewElement();
await prepareRouters();
}
index.html file:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>
<script src='https://cdn.firebase.com/js/client/2.2.7/firebase.js'></script>
<!-- JSON-Schema library tv4-->
<script src="packages/web_tt_client/js/tv4/tv4.min.js"></script>
<script src="packages/web_components/webcomponents.min.js"></script>
</head>
<body>
<page-view></page-view>
<br>
<div id="html_log" style="white-space: nowrap;"></div>
<script type="application/dart" src="spa.dart"></script>
<script src="packages/browser/dart.js"></script>
</body>
</html>
Pub update. Newer version of packages avalible for:
grinder 0.6.6+3 (0.8.0+2 available)
http_multi_server 1.3.2 (2.0.0 available)
http_parser 0.0.2+8 (2.0.0 available)
postgresql 0.2.14 (0.3.3 available)
redstone 0.5.21+1 (0.6.0+1 available)
redstone_mapper 0.1.13 (0.2.0-beta.1+1 available)
redstone_mapper_pg 0.1.1 (0.2.0-beta.2+2 available)
shelf 0.5.7 (0.6.4+3 available)
test 0.12.3+9 (0.12.7 available)

Change pubspec.yaml dependency_overrides section, can solve it.
dependency_overrides:
code_transformers: '^0.4.0'
reflectable:'^0.5.0'
redstone: '0.5.21+1'
quiver: '>=0.21.3 <0.22.0'
analyzer:'0.27.1'
polymer:'^1.0.0-rc.5'
args: '>=0.12.1 <0.14.0'

Related

Polymer-dart: http://www.xxx/index.bootstrap.initialize.dart Failed to load resource - where is it?

I have a Dart (1_16_0_dev_2) Polymer web app. I see >the problem here< , but I still have it. My yaml is :
dependencies:
browser: ^0.10.0
polymer: ^1.0.0-rc.16
polymer_elements: ^1.0.0-rc.8
transformers:
- polymer:
entry_points:
- web/index.html
- $dart2js:
$include: '**/*.bootstrap.initialize.dart' (I've tried with and without this line)
minify: true
commandLineOptions:
- --trust-type-annotations
- --trust-primitives
I've tried without the dart2js too. I can view my website in (some!?) Chromes on different devices, but Dartium gives this complaint
http://www.xxx/index.bootstrap.initialize.dart Failed to load resource: the server responded with a status of 404 (Not Found)
(and I assume it's why FireFox and Edge show a blank page).
What am I doing wrong please?
Thanks,
cheers,
s
I was missing:
<script src="packages/web_components/webcomponents-lite.min.js"></script>
in index.html. Now it works in Firefox, and Dartium isn't looking for the bootstrap file.

Custom Angular Dart Component Package

I have an angular dart component I created that I am trying to use in my main project. I am using path packages to reference it. The component's constructor (in the dart file) is being called, but I get errors that the .css and .html file cannot be found. The paths it is looking for them in seem to exist, so I'm not sure why it cannot find them.
I have other custom components I am using throughout my code, but there is no html or css files associated with them and they were fine, it seems to be limited to the html and css files.
Here are snippets of my code
test.dart located in test_component/lib/test_component/
library TestCom;
import 'package:angular/angular.dart';
#Component(
selector: 'tester',
templateUrl: 'test.html',
cssUrl: 'test.css')
class TestComponent {
String t = "this is the test component";
TestComponent() {
print("Test Component STARTED");
}
}
test.html located in test_component/lib/test_component/
<h3>{{t}}</h3>
pubspec.yaml located in test_component
name: TestModule
dependencies:
angular: "^1.1.2+2"
browser: any
transformers:
- angular:
html_files:
- lib/test_component/test.html
main.dart located in main/src/main/dart/web
import 'package:TestModule/test_component/test.dart';
class MyAppModule extends Module {
MyAppModule() {
bind(TestComponent);
}
}
index.html located in main/src/main/dart/web/
<tester></tester>
pubspec.yaml located in main/src/main/dart
name: main_package
dependencies:
angular: "^1.1.2+2"
browser: any
shadow_dom: any
json_object: any
bootjack: any
crypto: any
xml: "^2.3.2"
TestModule:
path: ../../../../test_component
transformers:
- angular:
After I run pub get, in the packages folder of my main project, TestModule/test_component/ exists with test.css, test.dart, and test.html in it. I'm not sure why when I run it, it can not find the .html and .css files.
This is what is displayed in the console when I run it
Observatory listening at http://127.0.0.1:54254/
Test Component STARTED
index.html:1 GET http://127.0.0.1:3030/packages/TestModule/test_component/test.css 404 (Not Found)
index.html:1 GET http://127.0.0.1:3030/packages/TestModule/test_component/test.html 404 (Not Found)
2 HTTP 404: <html><head><title>404 Not Found</title></head><body>File not found</body></html>
STACKTRACE:
null
Try this
name: TestModule
dependencies:
angular: "^1.1.2+2"
browser: any
transformers:
- angular:
html_files:
- packages/TestModule/test_component/test.html
For the css file however, I think you only need to put them into the same folder as the component's Dart file.

dart2js Polymer Dart Sample ClickCounter App is OK in Firefox, fails in Chrome

I am trying out a Polymer Dart App under Cordova. So I started with the Dart Editor Sample App.
I use a recent version of Polymer so I had to edit the sample code. Here is my pubspec.yaml
name: cortst
description: Cordova Test Application
dependencies:
polymer: '>=0.15.1+3 <0.16.0'
transformers:
- polymer:
entry_points:
- web/cortst.html
And here is the combined HTML and Dart. I think the initialization uses the new/approved technique:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sample App</title>
<link rel="import" href="clickcounter.html">
<link rel="stylesheet" href="cortst.css">
<script type="application/dart">
import 'dart:async';
import 'package:polymer/polymer.dart';
void main() {
initPolymer().run( () {
Polymer.onReady.then( (_) {
new Future( () {
// stuff goes here!
});
});
});
}
</script>
</head>
<body>
<h1>A Test</h1>
<div id="sample_container_id">
<click-counter count="5"></click-counter>
</div>
</body>
</html>
To generate stand-alone JavaScript I run dart2js via the command line:
pub build --mode=debug
And these are the results:
Dartium (37.0.2062.120 (292122) via Dart Editor 1.7.2) - OK
Run as JavaScript on Chrome (38.0.2125.111 m) - OK
Run as JavaScript on Firefox (33.0.3) - OK
dart2js and run on Chrome - no shadow DOM.
dart2js and run on Firefox - OK
When it fails the click counter is rendered (invisibly) as
<click-counter count="5"></click-counter>
This Chrome problem matters because the standard web host on Android is Chrome.
For brevity, I have embedded the Dart script in the HTML. I get the same results when I use a separate .dart file.
Perhaps I have overlooked something - it wouldn't be the first time...

dart-polymer: failed to load resource using core-elements

I want to use the core-scaffold element from the core-elements package. I imported
<link rel="import" href="packages/core_elements/core-scaffold.html">
<link rel="import" href="packages/core_elements/core-header-panel.html">
<link rel="import" href="packages/core_elements/core-menu.html">
<link rel="import" href="packages/core_elements/core-item.html">
into my html file. If i want to run the website i get
Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:8080/packages/core_elements/core-scaffold.html
Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:8080/packages/core_elements/core-header-panel.html
Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:8080/packages/core_elements/core-menu.html
Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:8080/packages/core_elements/core-item.html
I also use some elements from the page-elements package without any problems...
This is my pubspec.yaml file
name: Test
description: A sample web application
dependencies:
browser: any
polymer: ">=0.15.0 <0.16.0"
core_elements: ">=0.3.0 <0.4.0"
paper_elements: ">=0.4.0 <0.5.0"
transformers:
- polymer
I tried to delete and reload the core-elements package with pub get. But it doesnt help.
ok solved the problem. In the Polymere guide they used "-" in the links. The packages which the dart editor downloads use "_" in the links.
So its not core-header-panel. Its core_header_panel.

Module.DEFAULT_REFLECTOR not initialized

I'm setting up an AngularDart/PolymerDart project, but I keep running against the following error:
Breaking on exception: Module.DEFAULT_REFLECTOR not initialized for dependency injection. http://goo.gl/XFXx9G
Now I've read the page behind the url given at the end of the error and did some Stackoverflowing, but the only sollution I came across was adding -angular as a transformer in the pubspect.yaml. And so I did. But still I keep getting the same error and my project won't start.
My pubspec.yaml:
name: application
description: application
dependencies:
angular: '>=1.0.0 <2.0.0'
angular_node_bind: any
core_elements: '>=0.3.2 <0.5.0'
paper_elements: '>=0.5.0 <0.6.0'
polymer: '>=0.14.0 <0.16.0'
web_components: '>=0.9.0 <0.10.0'
dependency_overrides:
args: '>=0.10.0 <0.12.0'
code_transformers: '>=0.1.4+2 <0.3.0'
html5lib: '>=0.10.0 <0.13.0'
observe: '>=0.11.0 <0.13.0'
transformers:
- angular
- polymer:
entry_points:
- client/web/index.html
index.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Application</title>
<!-- include the web_components polyfills with support for Dart. -->
<script src="../packages/web_components/platform.js"></script>
<!-- imports -->
<link rel="import" href="../packages/polymer/polymer.html">
<link rel="import" href="components/component.html">
</head>
<body>
<!--
don't put ng-app on html or body. the polymer build inlines
custom elements definitions, which can trigger bugs if the code
inlined is inside of ng-app
-->
<div ng-app>
<section>
<p>Angular</p>
<p>
<input type="text" ng-model="cool"> Angular binding: {{cool}}
</p>
</section>
<section>
<p>Polymer</p>
<my-element message="[[ cool ]]"></my-element>
</section>
</div>
<!-- initialize -->
<script type="application/dart" src='dart/init.dart'></script>
<script src="../packages/browser/dart.js"></script>
</body>
</html>
init.dart:
import 'package:polymer/polymer.dart';
import 'package:angular/application_factory.dart';
import 'package:angular_node_bind/angular_node_bind.dart' show NodeBindModule;
void main() {
initPolymer()
.run(() {
applicationFactory()
.addModule(new NodeBindModule())
.run();
});
}
It appears that the "web" folder MUST be in the same folder as your pubspec.yaml. I placed the web folder inside a folder "client", which caused the problem. Putting the web folder in the project root folder again fixed the issue.

Resources