我有以下文件race.dart
// Copyright(c)2015
@export
@jsonObject
@ValidIf( _isRaceValid, customDescription: '$invalidStr Race' )
class Race extends Object
with JsProxy, Exportable {
@export
@jsonProperty
@reflectable
@ValidIf( isRequiredNounValid, customDescription: 'invalid noun' )
@NotEmpty( )
@Length( min: 2 )
String race = '';
@export
@jsonProperty
@reflectable
@ValidIf( isOptionalNounValid, customDescription: 'Invalid nound' )
String ethnicGroup = '';
@export
@jsonProperty
bool isValid = false;
}
bool _isRaceValid( Race r ) {
if (( r.race.length >= 2 ) &&
(r.ethnicGroup.isEmpty )) {
return r.isValid = true;
}
else {
return r.isValid = false;
}
}
name: epimss_polymer_reg
description: A starting point for Dart libraries or applications.
version: 0.0.1
author: zoong <zonga@gmail.com>
#homepage: https://www.example.com
environment:
sdk: '>=1.8.3 <2.0.0'
dependencies:
#async_commands: ^0.2.5
bwu_fontawesome_iconset_svg: ^0.3.0-1
drails_validator: ^0.0.1
exportable: ^0.1.0
jsonx: ^2.0.1
polymer_elements: ^1.0.0-rc.1
polymer: ^1.0.0-rc.2
reflectable: ^0.3.1
validator: ^0.0.4
web_components: ^0.12.0
dependency_overrides:
drails_commons: '0.0.6'
logging: '0.11.2'
dev_dependencies:
test: ^0.12.0
当我尝试运行我的应用程序(index.html)时,pub serve
显示以下错误Cannot handle private identifier _isRaceValid
[Error from Reflectable on epimss_polymer_app|ReflectableTransformed]:
我看到我正在使用的可反映的0.3.3在https://pub.dartlang.org/packages/reflectable提供有关私人标识符的一些信息
任何帮助将不胜感激。
由于
我按照你的建议做了Gunter。现在我看到了DartAnalysis中的错误或任何地方的错误。但现在应用程序运行,显示空白页面并显示没有输出错误。
我的index.dart是
import 'package:bwu_fontawesome_iconset_svg/bwu_fontawesome_iconset_svg.dart';
import 'package:epimss_polymer_app/main_app.dart';
import 'package:polymer/polymer.dart';
/// [MainApp] used!
main() async {
await initPolymer();
}
当我使用debug运行应用程序时,我得到以下内容:
天文台聆听http://127.0.0.1:63906/ 内部错误:'http://localhost:63342/epimss_polymer_app/web/index.dart':错误:第40行pos 2016:表达式不是有效的编译时常量 final _data = {const prefix0.JsProxyReflectable():new r.ReflectorData([new r.ClassMirrorImpl(r“PolymerMixin”,r“polymer.src.common.polymer_js_proxy.PolymerMixin”,519,0,const prefix0.JsProxyReflectable() ,const [],const [],const [],-1,{},{},const {},-1,0,const [],const [prefix0.jsProxyReflectable]),new r.ClassMirrorImpl(r“ JsProxy“,r”polymer.lib.src.common.js_proxy.JsProxy“,519,1,const prefix0.JsProxyReflectable(),const [],const [],const [],-1,{},{}, const {},-1,1,const [],const [prefix0.jsProxyReflectable]),new r.ClassMirrorImpl(r“dart.dom.html.HtmlElement with polymer.src.common.polymer_js_proxy.PolymerMixin”,r“polymer .lib.polymer_micro.dart.dom.html.HtmlElement with polymer.src.common.polymer_js_proxy.PolymerMixin“,583,2,const prefix0.JsProxyReflectable(),const [],const [173,174,175],const [ ],-1,const {},const {},const {},-1,0,const [],const []),new r.ClassMirrorImpl(r“PolymerSerialize”,r“polymer.src.common.polymer_serialize .PolymerSeri alize“,519,3,const prefix0.JsProxyReflectable(),const [176,177],const [176,177],const [],-1,{},{},const {},-1,3, const [0],const []),new r.ClassMirrorImpl(r“dart.core.Object with polymer.lib.src.common.js_proxy.JsProxy”,r“epimss_polymer_shared.data.dart.core.Object with polymer。 lib.src.common.js_proxy.JsProxy“,583,4,const prefix0.JsProxyReflectable(),const [],const [],const [],-1,const {},const {},const {}, - 1,1,const [],const []),新r.ClassMirrorImpl(r“ClinicalFeature”,r“epimss_polymer_shared.data.ClinicalFeature”,7,5,const prefix0.JsProxyReflectable(),const [0,1,2, ,3,4,5,6],const [178,179,180,181,182,183,184,185,186,187,188,189,190,191],const [],1,{}, {},{},-1,5,const [],const [prefix12.jsonObject,const prefix13.ValidIf(prefix4.isClinicalFeatureValid,customDescription:'ClinicalFeature $ invalidStr')]),new r.ClassMirrorImpl(r“WebOptions” ,
......更多类似的输出(超过140,000)字符。
这一切意味着什么?
name: epimss_polymer_app
version: 0.0.1
description: A web app built using polymer.dart.
author:
#homepage: https://www.example.com
environment:
sdk: '>=1.9.0 <2.0.0'
dependencies:
browser: ^0.10.0
bwu_fontawesome_iconset_svg: ^0.3.0-1
epimss_polymer_reg:
path: J:/workspace/epimss/dart/epimss_polymer_reg
epimss_polymer_shared:
path: J:/workspace/epimss/dart/epimss_polymer_shared
epimss_shared_core:
path: J:/workspace/epimss/dart/epimss_shared_core
polymer_elements: ^1.0.0-rc.1
polymer: ^1.0.0-rc.2
reflectable: ^0.3.1
web_components: ^0.12.0
dependency_overrides:
drails_commons: '0.0.6'
logging: '0.11.2'
dev_dependencies:
test: ^0.12.5
transformers:
- web_components:
entry_points: web/index.html
- reflectable:
entry_points: web/index.dart
- $dart2js:
$include: '**/*.bootstrap.initialize.dart'
minify: true
commandLineOptions:
- --trust-type-annotations
- --trust-primitives
- test/pub_serve:
$include: test/**_test{.*,}.dart
答案 0 :(得分:1)
dart:mirrors
且反映无法访问私人会员。
要解决此问题,您需要公开_isRaceValid
。