这适用于Dart-VM:
final List<String> names = [ "Bob", "JOE" ];
final InstanceMirror instanceMirror = reflect(names);
final Symbol function = new Symbol("[]");
final InstanceMirror getField = instanceMirror.invoke(function,[ 1 ]);
context = getField.reflectee;
_logger.info("Value $context"); // Shows JOE
但是如果我把它编译成JS就失败了。 错误消息:`NoSuchMethodError:找不到方法:'[]'接收方:'JSArray'参数的实例:[1]'
我也尝试过使用elementAt而不是[],然后我得到:Unsupported operation: Can't use 'elementAt:1' in reflection because it is not included in a @MirrorsUsed annotation.