Angular Dart with polymer and non-working

I am currently trying to create a web application that is compliant with the Google Progressive Web Apps specs. For this I use Angular with Dart and Polymer based web components instead of Angular components. So far, everything is working as expected. To make my app offline using the Service-Worker API I am using the following dart lib: https://github.com/isoos/service_worker

Using Polymer or Service-Worker works great, but the combo stand just fails when the application starts.

This is my AppComponent launcher:

// ... other imports
import 'package:service_worker/window.dart' as sw; // <-- import alone causes the error

Future main() async {
  await initPolymer();  // <-- causes the error in combination with the import above
  bootstrap(AppComponent);

  if (sw.isNotSupported) {
    print('ServiceWorkers are not supported.');
    return;
  }
  //... initializing service worker
}

      

The error occurs even if I don't initialize the Service-Worker, importing the Service-Worker module is enough to cause the error.

Building the application works without errors.

I am new to Dart and Polymer and Angular eco systems and the error message I get is not very helpful to me:

Uncaught Error: NoSuchMethodError: method not found: js_helper.dart:1742 'h' (J.Q(...).h is not a function)
    at Object.J.H (http://127.0.0.1:8080/index.bootstrap.initialize.dart.js:9747:15)
    at http://127.0.0.1:8080/index.bootstrap.initialize.dart.js:10559:1584
    at Isolate.e.(anonymous function) (http://127.0.0.1:8080/index.bootstrap.initialize.dart.js:10608:15)
    at Object.yK (http://127.0.0.1:8080/index.bootstrap.initialize.dart.js:9291:22)
    at http://127.0.0.1:8080/index.bootstrap.initialize.dart.js:9282:10
    at yM.a (http://127.0.0.1:8080/index.bootstrap.initialize.dart.js:2612:72)
    at yM.dart.yM.$2 (http://127.0.0.1:8080/index.bootstrap.initialize.dart.js:2828:24)
    at y9.dart.y9.$1 (http://127.0.0.1:8080/index.bootstrap.initialize.dart.js:2824:31)
    at xM.bi (http://127.0.0.1:8080/index.bootstrap.initialize.dart.js:3767:40)
    at xk.$0 (http://127.0.0.1:8080/index.bootstrap.initialize.dart.js:3167:16)

      

Can you give me a hint what might be causing the error and how to fix it? I'd really like to use Polymer components instead of regular Angular components, but I need a Service-Worker to support offline caching.

+3


source to share


1 answer


This looks like an issue caused by an incompatibility between dart:js

(old style used by original polymer pack) and package:js

(new style used by all new packs including package:service_worker

).



Perhaps you should take a look at the polyize project , which Polymer brings through a new style of interaction. Then you will have no conflict.

+2


source







All Articles