Using reflection
The Dart mirror-based reflection API (contained in the dart:mirrors
library) provides a powerful set of tools to reflect on code. This means that it is possible to introspect the complete structure of a program and discover all the properties of all the objects. In this way, methods can be invoked reflectively. It will even become possible to dynamically evaluate code that was not yet specified literally in the source code. An example of this would be calling a method whose name was provided as an argument because it is looked up in the database table.
Getting ready
The part of your code that uses reflection should have the following import code:
import 'dart:mirrors';
How to do it...
To perform reflection we perform the following ...
Get Dart: Scalable Application Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.