pub serve 输出错误 "Cannot handle private identifier"

pub serve output error that it "Cannot handle private identifier"

我有以下文件race.dart

race.dart

// 版权所有 (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;
  }
}

pubspec.yaml

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

提供了一些关于私有标识符的信息

任何帮助将不胜感激。

谢谢

编辑 1

我按照冈特的建议做了。现在我在 DartAnalysis 或任何地方看到错误提示。但是应用程序现在 运行s,显示空白页面并且没有输出错误。

我的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();
}

当我 运行 调试应用程序时,我得到以下信息:

Observatory listening at http://127.0.0.1:63906/ Internal error: 'http://localhost:63342/epimss_polymer_app/web/index.dart': error: line 40 pos 2016: expression is not a valid compile-time constant 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.PolymerSerialize", 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 []), new 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 个)字符。

这一切意味着什么?

编辑 2 - pubspec.yaml

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

dart:mirrors 和 reflectable 无法访问私有成员。 要修复它,您需要制作 _isRaceValid public。