polymerdartdart-polymer

Is there any way to debug a TypeError: Invalid value used as weak map key?


I'm using Dart + Polymer and we were creating a new version of our app, that was going with huge refactoring, deleting some pages and so on.

Now, there is a error

TypeError: Invalid value used as weak map key

I assume it is somehow connected to Iron List receiving null data, or some other polymer elements missing something.

But there is no valuable information in stack trace. Is there any way to debug this error, so I can understand the origin of this error?


Solution

  • So, I managed to debug the issue. Thats what helped me:

    1. I've set a break point to

      package:polymer/src/common/polymer_register.dart:21

      This step helped me to understand what exact Polymer Element is failing to register properly.

    2. It was a page, containing neon-animated-pages, so I've commented everything and uncommented one-by-one to locate the page
    3. There I was able to determine the Iron list which was receiving the null data and causing the error.

    It would be great for Polymer to be more exact on their errors, as I cost me like 6 hours to locate the error. But I'm glad everything is ok now, so this step may help someone to have more smooth experience with Dart/Polymer