gpt4 book ai didi

dart - Dart 2异步软件包预编译错误

转载 作者:行者123 更新时间:2023-12-03 03:42:38 25 4
gpt4 key购买 nike

我正在尝试使用webdev使用Dart 2 SDK运行Web应用程序。我终于得到了成功解决的依赖关系,但是现在pub get无法预编译async包。

我发现此问题似乎相关,但是他们建议的pub global run解决方法无效:https://github.com/dart-lang/pub/issues/1932

pubspec.yaml

environment:
sdk: '>=2.0.0-dev.68.0 <3.0.0'

dependencies:
browser_detect: ^1.0.4
dnd: ^1.2.0
firebase: ^0.5.0
gorgon: ^0.14.2
intl: ^0.15.6
jsonx: ^2.0.2
slack: ^1.2.2
stagexl: ^1.3.1+4
xml: ^3.0.0

dev_dependencies:
build_runner: '>=0.8.10 <0.10.0'
build_web_compilers: '>=0.3.6 <0.5.0'

酒馆得到

Dart VM版本:“linux_x64”上的2.0.0-dev.69.0(未知时间戳)
Resolving dependencies...
Overriding the upper bound Dart SDK constraint to <=2.0.0-dev.69.0 for the following packages:

args, async, browser, browser_detect, coUemoticons, convert, cou_toolkit, edit_distance, firebase, fixnum, glob, gorgon, graphs, http_parser, js, jsonx, libld, logging, meta, petitparser, pub_semver, quiver, quiver_iterables, scproxy, slack, source_span, stack_trace, stagexl, string_scanner, transmit, typed_data, xml

To disable this you can set the PUB_ALLOW_PRERELEASE_SDK system environment variable to `false`, or you can silence this message by setting it to `quiet`.
Got dependencies!
Precompiling executables...
Failed to precompile build_runner:graph_inspector:
file:///home/andy/.pub-cache/hosted/pub.dartlang.org/async-1.13.3/lib/src/typed/stream.dart:56:10: Error: The return type of the method 'TypeSafeStream::firstWhere' is dart.async::Future<dynamic>, which does not match the return type of the overridden method (dart.async::Future<#lib1::TypeSafeStream::T>).
Change to a subtype of dart.async::Future<#lib1::TypeSafeStream::T>.
Future firstWhere(bool test(T element), {Object defaultValue()}) =>
^
file:///home/andy/.pub-cache/hosted/pub.dartlang.org/async-1.13.3/lib/src/typed/stream.dart:56:10: Error: The method 'TypeSafeStream::firstWhere' doesn't have the named parameter 'orElse' of overriden method 'Stream::firstWhere'.
Future firstWhere(bool test(T element), {Object defaultValue()}) =>
^
file:///home/andy/.pub-cache/hosted/pub.dartlang.org/async-1.13.3/lib/src/typed/stream.dart:59:10: Error: The return type of the method 'TypeSafeStream::lastWhere' is dart.async::Future<dynamic>, which does not match the return type of the overridden method (dart.async::Future<#lib1::TypeSafeStream::T>).
Change to a subtype of dart.async::Future<#lib1::TypeSafeStream::T>.
Future lastWhere(bool test(T element), {Object defaultValue()}) =>
^
file:///home/andy/.pub-cache/hosted/pub.dartlang.org/async-1.13.3/lib/src/typed/stream.dart:59:10: Error: The method 'TypeSafeStream::lastWhere' doesn't have the named parameter 'orElse' of overriden method 'Stream::lastWhere'.
Future lastWhere(bool test(T element), {Object defaultValue()}) =>
^
file:///home/andy/.pub-cache/hosted/pub.dartlang.org/async-1.13.3/lib/src/typed/stream.dart:62:13: Error: The method 'TypeSafeStream::singleWhere' has fewer named arguments than those of overridden method 'Stream::singleWhere'.
Future<T> singleWhere(bool test(T element)) async =>
^
file:///home/andy/.pub-cache/hosted/pub.dartlang.org/async-1.13.3/lib/src/restartable_timer.dart:11:7: Error: The non-abstract class 'RestartableTimer' is missing implementations for these members:
'tick'.
Try to either
- provide an implementation,
- inherit an implementation from a superclass or mixin,
- mark the class as abstract, or
- provide a 'noSuchMethod' implementation.

class RestartableTimer implements Timer {
^^^^^^^^^^^^^^^^
file:///home/andy/.pub-cache/hosted/pub.dartlang.org/async-1.13.3/lib/src/result/capture_transformer.dart:15:7: Error: The non-abstract class 'CaptureStreamTransformer' is missing implementations for these members:
'cast'.
Try to either
- provide an implementation,
- inherit an implementation from a superclass or mixin,
- mark the class as abstract, or
- provide a 'noSuchMethod' implementation.

class CaptureStreamTransformer<T> implements StreamTransformer<T, Result<T>> {
^^^^^^^^^^^^^^^^^^^^^^^^
file:///home/andy/.pub-cache/hosted/pub.dartlang.org/async-1.13.3/lib/src/result/release_transformer.dart:12:7: Error: The non-abstract class 'ReleaseStreamTransformer' is missing implementations for these members:
'cast'.
Try to either
- provide an implementation,
- inherit an implementation from a superclass or mixin,
- mark the class as abstract, or
- provide a 'noSuchMethod' implementation.

class ReleaseStreamTransformer<T> implements StreamTransformer<Result<T>, T> {
^^^^^^^^^^^^^^^^^^^^^^^^
file:///home/andy/.pub-cache/hosted/pub.dartlang.org/async-1.13.3/lib/src/single_subscription_transformer.dart:16:7: Error: The non-abstract class 'SingleSubscriptionTransformer' is missing implementations for these members:
'cast'.
Try to either
- provide an implementation,
- inherit an implementation from a superclass or mixin,
- mark the class as abstract, or
- provide a 'noSuchMethod' implementation.

class SingleSubscriptionTransformer<S, T> implements StreamTransformer<S, T> {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
file:///home/andy/.pub-cache/hosted/pub.dartlang.org/async-1.13.3/lib/src/typed_stream_transformer.dart:23:7: Error: The non-abstract class '_TypeSafeStreamTransformer' is missing implementations for these members:
'cast'.
Try to either
- provide an implementation,
- inherit an implementation from a superclass or mixin,
- mark the class as abstract, or
- provide a 'noSuchMethod' implementation.

class _TypeSafeStreamTransformer<S, T> implements StreamTransformer<S, T> {
^^^^^^^^^^^^^^^^^^^^^^^^^^
Failed to precompile build_runner:build_runner:
file:///home/andy/.pub-cache/hosted/pub.dartlang.org/async-1.13.3/lib/src/typed/stream.dart:56:10: Error: The return type of the method 'TypeSafeStream::firstWhere' is dart.async::Future<dynamic>, which does not match the return type of the overridden method (dart.async::Future<#lib1::TypeSafeStream::T>).
Change to a subtype of dart.async::Future<#lib1::TypeSafeStream::T>.
Future firstWhere(bool test(T element), {Object defaultValue()}) =>
^
file:///home/andy/.pub-cache/hosted/pub.dartlang.org/async-1.13.3/lib/src/typed/stream.dart:56:10: Error: The method 'TypeSafeStream::firstWhere' doesn't have the named parameter 'orElse' of overriden method 'Stream::firstWhere'.
Future firstWhere(bool test(T element), {Object defaultValue()}) =>
^
file:///home/andy/.pub-cache/hosted/pub.dartlang.org/async-1.13.3/lib/src/typed/stream.dart:59:10: Error: The return type of the method 'TypeSafeStream::lastWhere' is dart.async::Future<dynamic>, which does not match the return type of the overridden method (dart.async::Future<#lib1::TypeSafeStream::T>).
Change to a subtype of dart.async::Future<#lib1::TypeSafeStream::T>.
Future lastWhere(bool test(T element), {Object defaultValue()}) =>
^
file:///home/andy/.pub-cache/hosted/pub.dartlang.org/async-1.13.3/lib/src/typed/stream.dart:59:10: Error: The method 'TypeSafeStream::lastWhere' doesn't have the named parameter 'orElse' of overriden method 'Stream::lastWhere'.
Future lastWhere(bool test(T element), {Object defaultValue()}) =>
^
file:///home/andy/.pub-cache/hosted/pub.dartlang.org/async-1.13.3/lib/src/typed/stream.dart:62:13: Error: The method 'TypeSafeStream::singleWhere' has fewer named arguments than those of overridden method 'Stream::singleWhere'.
Future<T> singleWhere(bool test(T element)) async =>
^
file:///home/andy/.pub-cache/hosted/pub.dartlang.org/async-1.13.3/lib/src/restartable_timer.dart:11:7: Error: The non-abstract class 'RestartableTimer' is missing implementations for these members:
'tick'.
Try to either
- provide an implementation,
- inherit an implementation from a superclass or mixin,
- mark the class as abstract, or
- provide a 'noSuchMethod' implementation.

class RestartableTimer implements Timer {
^^^^^^^^^^^^^^^^
file:///home/andy/.pub-cache/hosted/pub.dartlang.org/async-1.13.3/lib/src/result/capture_transformer.dart:15:7: Error: The non-abstract class 'CaptureStreamTransformer' is missing implementations for these members:
'cast'.
Try to either
- provide an implementation,
- inherit an implementation from a superclass or mixin,
- mark the class as abstract, or
- provide a 'noSuchMethod' implementation.

class CaptureStreamTransformer<T> implements StreamTransformer<T, Result<T>> {
^^^^^^^^^^^^^^^^^^^^^^^^
file:///home/andy/.pub-cache/hosted/pub.dartlang.org/async-1.13.3/lib/src/result/release_transformer.dart:12:7: Error: The non-abstract class 'ReleaseStreamTransformer' is missing implementations for these members:
'cast'.
Try to either
- provide an implementation,
- inherit an implementation from a superclass or mixin,
- mark the class as abstract, or
- provide a 'noSuchMethod' implementation.

class ReleaseStreamTransformer<T> implements StreamTransformer<Result<T>, T> {
^^^^^^^^^^^^^^^^^^^^^^^^
file:///home/andy/.pub-cache/hosted/pub.dartlang.org/async-1.13.3/lib/src/single_subscription_transformer.dart:16:7: Error: The non-abstract class 'SingleSubscriptionTransformer' is missing implementations for these members:
'cast'.
Try to either
- provide an implementation,
- inherit an implementation from a superclass or mixin,
- mark the class as abstract, or
- provide a 'noSuchMethod' implementation.

class SingleSubscriptionTransformer<S, T> implements StreamTransformer<S, T> {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
file:///home/andy/.pub-cache/hosted/pub.dartlang.org/async-1.13.3/lib/src/typed_stream_transformer.dart:23:7: Error: The non-abstract class '_TypeSafeStreamTransformer' is missing implementations for these members:
'cast'.
Try to either
- provide an implementation,
- inherit an implementation from a superclass or mixin,
- mark the class as abstract, or
- provide a 'noSuchMethod' implementation.

class _TypeSafeStreamTransformer<S, T> implements StreamTransformer<S, T> {
^^^^^^^^^^^^^^^^^^^^^^^^^^

我在 pubspec.yaml中做错什么了吗,或者 async或其他软件包有问题吗?该项目已经运行了大约4年,但是我无法在Dart 2中使用它。任何帮助都将受到赞赏。

最佳答案

您依赖于尚未针对Dart 2更新的几个库。不幸的是,唯一的解决方案是删除这些依赖关系或移回Dart 1 SDK。以供引用:

  • browser_detect:v 1.0.4•更新:2016年3月2日
  • gorgon v 0.14.2•更新:2014年12月6日
  • jsonx v 2.0.2•更新:2016年5月19日
  • 松弛1.2.2•更新:2015年6月6日,网址

  • 通常,只有最近一次在2018年某个时候更新的库才能在Dart 2中使用,并且通常仅是最新版本。您可以通过在 pub.dartlang.org上搜索包名称来检查依赖项的状态

    编辑:gorgon特别依赖于较旧版本的 async,我首先将其删除

    关于dart - Dart 2异步软件包预编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51392855/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com