Comments (3)
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.
Thank you @eernstg! Very helpful. I'll get back to you in a bit.
from reflectable.dart.
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)
- Fails when upgrading
- 【macos】Attempt to `invoke` without class mirrors. HOT 1
- [Question] is it possible build an "Angular Style DI" library using Reflectable? HOT 1
- [question] - Is it possible to have Annotations with Parameters? HOT 2
- [Question] - how to get Constructor arguments? HOT 2
- [Bug?] ERROR: This requires the 'constructor-tearoffs' language feature to be enabled. HOT 12
- [Question] - Listening to Method invocation HOT 6
- [Question] - Stats on Bundle Sizes and Performance Implications/metrics of using Reflectable ? HOT 1
- Cannot reflect ```flutter/material.dart``` URIs for ```Container``` type HOT 12
- This reflector does not match anything HOT 11
- Reflectable is not a know builder HOT 1
- Unsupported operation: location HOT 4
- Reflectable don't find "main" but im using in my library not an application HOT 5
- How to generate code according to filter rules HOT 2
- The build_runner those not generate anything HOT 1
- Annotated parameter and Functions
- Include annotated types that are not imported to `main.dart` HOT 2
- Severe error during build with @reflector and @JsonKey on the same class. HOT 1
- isSubtype exception for classes without parents HOT 2
- Where is initializeReflectable method? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reflectable.dart.