【问题标题】:Flutter : The getter 'Pestawait' isn't defined for the class 'RetryOptions'Flutter:没有为“RetryOptions”类定义吸气剂“Pestawait”
【发布时间】:2021-02-27 20:44:20
【问题描述】:

我尝试实现一个应用程序。我运行了几次,没有错误。但是没有任何原因,一天后我尝试运行我的应用程序,我得到了以下错误,我试图找到 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)

【问题讨论】:

    标签: flutter dart widget provider pup


    【解决方案1】:

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

    
     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));
        }
      }
    }
    
    

    【讨论】:

      猜你喜欢
      • 2021-03-04
      • 2020-05-11
      • 2021-04-14
      • 2020-06-26
      • 2021-09-17
      • 1970-01-01
      • 2021-08-22
      • 2021-03-26
      • 2020-12-07
      相关资源
      最近更新 更多