Coder Social home page Coder Social logo

Comments (3)

eernstg avatar eernstg commented on July 19, 2024

Presumably, the _data field in the relevant class mirror is null. One reason for having this behavior comes to mind: If the analyzer does not resolve all libraries delivered to the reflectable transformer then the transformer gets null for the value of constants. The typical consequence is that the file for the entry point (if you transform 'web/index.dart' then the transformed entry point file is 'build/web/index.dart') contains a declaration like final _data = {};. This essentially means that the "reflection database" that enables the reflectable package to do all its work is empty; this again means that almost nothing works, so this is only a plausible explanation if you see this failure early---if other things are done using reflectable mirrors before that then it is not a likely cause.

To check for final _data = {}; you can make sure that the Dart file is generated by using pub build --mode=debug <whatever_you_usually_specify_as_target_eg_test>, and then you can grep for '_data' in the transformed entry point file.

If this is the cause then it may be caused by a version skew: The analyzer up to version 0.26.1+14 delivered resolved libraries; for a while we used that, because newer versions delivered (some) libraries unresolved. Recently we updated to use analyzer version 0.27.1, because that one again delivers resolved libraries, but 0.27.1+1 again delivers (some) unresolved ones. With older versions of reflectable you'd use 0.26.1+14 (up to version 0.4.0), and the most recent one insists on 0.27.1, but v0.5.0 allows for newer versions (including 0.27.1+1).

If the problem is that you are using v0.5.0 rather than v0.5.1 then a simple pub upgrade should do it; if some other package prevents v0.5.1 or insists on analyzer 0.27.1+1-or-newer then it gets hairier, but you may wish to use a dependency_overrides: section in 'pubspec.yaml' and force a particular choice.

from reflectable.dart.

emilniklas avatar emilniklas commented on July 19, 2024

Thank you @eernstg! Very helpful. I'll get back to you in a bit.

from reflectable.dart.

emilniklas avatar emilniklas commented on July 19, 2024

Oh dearie me... I'm embarrassed. I had forgotten to add a new test file to entry_points and was confused why only that file got the strange JS error. My bad!

from reflectable.dart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.