Dart "NoSuchMethodError: Cannot call "get$data" (config.get$data is not a function)

Issue

I’m building an app with Angular Dart. When I’m trying to run it as a javascript it throws an error in the console (Firefox):

“NoSuchMethodError: Cannot call “get$data” (config.get$data is not a
function)

or for the same issue in Chrome:

NoSuchMethodError: undefined is not a function

In DevTools I figured that this error is thrown when the app is trying to download component’s html file. Error is caused by precompiled javascript code:

closure322: {
  "^": "Closure:139;",
  call$1: function(config) {
    config.get$data(config);
    config.get$data(config);
    return config;
  },
  $isFunction: true
},

I’ve checked properties of “config” variable and there is no “get$data” function.
I’m not sure how to proceed. I’ve tried pub upgrade and error still exists. There’s no error while I’m developing the app in Dartium and there everything works just fine.

Cheers.

Solution

I’ve exactly the same error. I believe it’s a bug in dart2js, along the lines of:

https://code.google.com/p/dart/issues/detail?id=18383

What puzzles me is that theoretically it should be resolved in 1.4.0, which I’m using, but it doesn’t seem so.

You don’t need to downgrade to angulardart 0.10.0. You can continue using 0.11 BUT you need to disable checked mode. This is a piece of my pubspec.yaml:

    transformers:
    - angular:
        html_files:
        - web/view/home.tpl.html
        - web/view/join.tpl.html
        - web/view/lobby.tpl.html
        - web/view/login.tpl.html
    - $dart2js:
        checked: false
        minify: false
        verbose: false
        analyzeAll: false
        suppressWarnings: false
        suppressHints: false
        terse: false

Answered By – Victor M.

Answer Checked By – David Goodson (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.