0

我尝试实现一个应用程序。我运行了几次,没有错误。但是没有任何理由,一天后我尝试运行我的应用程序,我收到以下错误,我尝试为 id 找到解决方案,但我没有找到任何东西。

那么有人可以提供我如何解决它吗?


Launching lib\main.dart on sdk gphone x86 in debug mode...
 lib\main.dart
../../../flutter/flutter/.pub-cache/hosted/pub.dartlang.org/retry-3.0.1/lib/retry.dart:131:16: Error: Expected ';' after this.
        return Pestawait fn();
               ^^^^^^^^^
../../../flutter/flutter/.pub-cache/hosted/pub.dartlang.org/retry-3.0.1/lib/retry.dart:131:16: Error: The getter 'Pestawait' isn't defined for the class 'RetryOptions'.
 - 'RetryOptions' is from 'package:retry/retry.dart' ('../../../flutter/flutter/.pub-cache/hosted/pub.dartlang.org/retry-3.0.1/lib/retry.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'Pestawait'.
        return Pestawait fn();
               ^^^^^^^^^
../../../flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_datetime_picker-1.4.0/lib/flutter_datetime_picker.dart:215:48: Error: No named parameter with the name 'shadowThemeOnly'.
    ThemeData inheritTheme = Theme.of(context, shadowThemeOnly: true);
                                               ^^^^^^^^^^^^^^^
../../../flutter/flutter/packages/flutter/lib/src/material/theme.dart:119:20: Context: Found this candidate, but the arguments don't match.
  static ThemeData of(BuildContext context) {
                   ^^


FAILURE: Build failed with an exception.

* Where:
Script 'D:\mohy\flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 900

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'D:\mohy\flutter\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 9m 1s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

4

1 回答 1

0

看来你的图书馆坏了。您可以删除该文件夹并再次安装该软件包。或者为了快速修复,您可以在相关文件中更改该部分,如下所示


 Future<T> retry<T>(
    FutureOr<T> Function() fn, {
    FutureOr<bool> Function(Exception)? retryIf,
    FutureOr<void> Function(Exception)? onRetry,
  }) async {
    var attempt = 0;
    // ignore: literal_only_boolean_expressions
    while (true) {
      attempt++; // first invocation is the first attempt
      try {
        return await fn(); // Here is broken!
      } on Exception catch (e) {
        if (attempt >= maxAttempts ||
            (retryIf != null && !(await retryIf(e)))) {
          rethrow;
        }
        if (onRetry != null) {
          await onRetry(e);
        }
      }

      // Sleep for a delay
      await Future.delayed(delay(attempt));
    }
  }
}

于 2020-11-16T16:25:00.267 回答