使用使用DartSON的库时出错

时间:2017-05-02 21:30:04

标签: dart dart-pub

我构建了一个简单的Dart库来包装Mastodon(社交平台)API - (来自https://github.com/mykdavies/Mastodon)。

我可以通过在pubspec.yaml

中添加适当的依赖项,在另一个项目中本地使用该库
dependencies:
  ...
  mastodon:
    path: /Users/mike/Documents/Development/dart/mastodon

一切正常。

我已将其发布到pub(https://pub.dartlang.org/packages/mastodon),但当我更改pubspec以使用此版本时:

dependencies:
  ...
  mastodon:
    ^0.1.0

我遇到了Dartson变形金刚的问题。任何人都可以帮我理解出了什么问题吗?

谢谢,迈克尔

完整的pubspec:

name: rssToot
description: A sample command-line application.
version: 0.0.1

environment:
  sdk: '>=1.20.1 <2.0.0'

dependencies:
  dart_feed: "^0.0.4"
  oauth2: ^1.0.2
  mime: ^0.9.2
  mastodon:
    ^0.1.0

dev_dependencies:
  test: ^0.12.0

完整堆栈跟踪:

Resolving dependencies...
> mastodon 0.1.0 (was 0.0.5)
Downloading mastodon 0.1.0...
Changed 1 dependency!
Precompiling dependencies...
Loading source assets...
Loading dartson transformers...
Transform Dartson on mastodon|lib/src/mastodon_base.dart threw error: The getter 'name' was called on null.
Receiver: null
Tried calling: name
dart:core-patch/object_patch.dart 43       Object._noSuchMethod
dart:core-patch/object_patch.dart 47       Object.noSuchMethod
package:dartson/transformer.dart 218       FileCompiler.buildEntityMap.<fn>
dart:collection/list.dart 63               Object&ListMixin.forEach
package:dartson/transformer.dart 213       FileCompiler.buildEntityMap
package:dartson/transformer.dart 132       FileCompiler._prepareEntities.<fn>
dart:core-patch/growable_array.dart 256    List.forEach
package:dartson/transformer.dart 131       FileCompiler._prepareEntities
package:dartson/transformer.dart 104       FileCompiler.build
package:dartson/transformer.dart 55        DartsonTransformer.apply.<fn>
dart:async/zone.dart 1371                  _RootZone.runUnary
dart:async/future_impl.dart 129            _FutureListener.handleValue
dart:async/future_impl.dart 631            _Future._propagateToListeners.handleValueCallback
dart:async/future_impl.dart 660            _Future._propagateToListeners
dart:async/future_impl.dart 474            _Future._completeWithValue
dart:async/future_impl.dart 522            _Future._asyncComplete.<fn>
dart:async/schedule_microtask.dart 41      _microtaskLoop
dart:async/schedule_microtask.dart 50      _startMicrotaskLoop
dart:isolate-patch/isolate_patch.dart 99   _runPendingImmediateCallback
dart:isolate-patch/isolate_patch.dart 152  _RawReceivePortImpl._handleMessage

dart:core                             Object.noSuchMethod
package:dartson/transformer.dart 218  FileCompiler.buildEntityMap.<fn>
dart:collection                       Object&ListMixin.forEach
package:dartson/transformer.dart 213  FileCompiler.buildEntityMap
package:dartson/transformer.dart 132  FileCompiler._prepareEntities.<fn>
dart:core                             List.forEach
package:dartson/transformer.dart 131  FileCompiler._prepareEntities
package:dartson/transformer.dart 104  FileCompiler.build
package:dartson/transformer.dart 55   DartsonTransformer.apply.<fn>
package:pub/src/entrypoint.dart 269                                              Entrypoint._precompileDependencies.<fn>
===== asynchronous gap ===========================
package:pub/src/log.dart 408                                                     progress
package:pub/src/entrypoint.dart 254                                              Entrypoint._precompileDependencies
===== asynchronous gap ===========================
package:pub/src/entrypoint.dart 226                                              Entrypoint.acquireDependencies
===== asynchronous gap ===========================
package:pub/src/command/get.dart 38                                              GetCommand.run
package:args/command_runner.dart 194                                             CommandRunner.runCommand
===== asynchronous gap ===========================
package:pub/src/command_runner.dart 168                                          PubCommandRunner.runCommand.<fn>
dart:async                                                                       Future.Future.sync
package:pub/src/utils.dart 99                                                    captureErrors.<fn>
dart:async                                                                       runZoned
package:pub/src/utils.dart 118                                                   captureErrors
package:pub/src/command_runner.dart 168                                          PubCommandRunner.runCommand
===== asynchronous gap ===========================
package:pub/src/command_runner.dart 117                                          PubCommandRunner.run
===== asynchronous gap ===========================
/b/build/slave/dart-sdk-mac-stable/build/sdk/third_party/pkg/pub/bin/pub.dart 8  main
Process finished with exit code 0

1 个答案:

答案 0 :(得分:2)

尝试在本地干净地检查您的git存储库,并在那里使用初始化。由于某种原因,dartson变压器可能没有从0.0.5 - >接收变化。 0.1.0,使用了一些缓存值,并且在开发时没有抱怨。