Comments (3)
This looks more like a case where configurable imports are involved, such that one variant of the program will "use reflection" and the other one will not.
The Reflectable transformer transforms a program that uses dart:mirrors (indirectly, behind a layer of wrappers with statically known types from package:reflectable/mirrors.dart) into a modified version of the program that uses a statically generated set of mirrors (such that there is no dependency on dart:mirrors). The client code will no longer have an "import 'package:reflectable/reflectable.dart';" anywhere, but it will appear to use reflection just as much as it did before the transformation. The difference is only that the pre-transform code relied (indirectly) on dart:mirrors, and the post-transform code does not.
So, as far as I can see, you won't get into a situation where you have any unused imports as described.
from reflectable.dart.
I can see where the transformed code may be able to avoid the unused import warning. But in pre-transform (source) code, where it counts most, the unused import will clearly still be there if there is an import used only reflectively. So there would need to be support for informing the analyzer that the import is being used reflectively.
from reflectable.dart.
I'm not sure I understand what you mean. Both pre-transform and post-transform code would contain reflective constructs, or maybe both of them don't (but that's a pathological case, then there's no need to use Reflectable at all). So when would that import be unused? The Reflectable transformer does not remove "reflective code" during transformation, it redefines the meaning of such code, in order to eliminate the (indirect) dependency on dart:mirrors. This happens because classes such as InstanceMirror are implemented using dart:mirrors in pre-transform code, and they are statically generated (not depending on dart:mirrors) in the post-transform code.
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.