升级 flutter 2.0 版时出错

时间:2021-01-20 10:55:10

标签: android ios flutter web flutter-web

我尝试在网络浏览器中运行 Flutter 应用程序时出错。

以下是我在运行应用程序时得到的输出:

Launching lib/main.dart on Chrome in debug mode...

Waiting for connection from debug service on Chrome...
../../../.pub-cache/hosted/pub.dartlang.org/wav

e-0.1.0/lib/config.dart:46:13: Error: Method not found: 'throwNullError'.
                throwNullError('custom', 'colors` or `gradients');
                ^^^^^^^^^^^^^^
    ../../../.pub-cache/hosted/pub.dartlang.org/wave-0.1.0/lib/config.dart:60:13: Error: Method not found: 'throwNullError'.
                throwNullError('custom', 'durations');
                ^^^^^^^^^^^^^^
    ../../../.pub-cache/hosted/pub.dartlang.org/wave-0.1.0/lib/config.dart:66:13: Error: Method not found: 'throwNullError'.
                throwNullError('custom', 'heightPercentages');
                ^^^^^^^^^^^^^^
    ../../../.pub-cache/hosted/pub.dartlang.org/flutter_platform_widgets-0.60.2/lib/src/platform_app_bar.dart:209:9: Error: No named parameter with the name 'actionsForegroundColor'.
            actionsForegroundColor: data?.actionsForegroundColor,
            ^^^^^^^^^^^^^^^^^^^^^^
    ../../FlutterProjects/SDK/flutter/packages/flutter/lib/src/cupertino/nav_bar.dart:220:9: Context: Found this candidate, but the arguments don't match.
      const CupertinoNavigationBar({
            ^^^^^^^^^^^^^^^^^^^^^^
    ../../../.pub-cache/hosted/pub.dartlang.org/flutter_platform_widgets-0.60.2/lib/src/platform_app_bar.dart:229:7: Error: No named parameter with the name 'actionsForegroundColor'.
          actionsForegroundColor: data?.actionsForegroundColor,
          ^^^^^^^^^^^^^^^^^^^^^^
    ../../FlutterProjects/SDK/flutter/packages/flutter/lib/src/cupertino/nav_bar.dart:220:9: Context: Found this candidate, but the arguments don't match.
      const CupertinoNavigationBar({
            ^^^^^^^^^^^^^^^^^^^^^^
    ../../../.pub-cache/hosted/pub.dartlang.org/flutter_neumorphic-3.0.3/lib/src/widget/app_bar.dart:147:57: Error: No named parameter with the name 'nullOk'.
        final ScaffoldState scaffold = Scaffold.of(context, nullOk: true);
                                                            ^^^^^^
    ../../FlutterProjects/SDK/flutter/packages/flutter/lib/src/material/scaffold.dart:1930:24: Context: Found this candidate, but the arguments don't match.
      static ScaffoldState of(BuildContext context) {
                           ^^
    ../../FlutterProjects/SDK/flutter/packages/flutter_localizations/lib/src/material_localizations.dart:413:7: Error: Method 'replaceFirst' cannot be called on 'String?' because it is potentially null.
    Try calling using ?. instead.
        ).replaceFirst(r'$selectedRowCount', formatDecimal(selectedRowCount));
          ^^^^^^^^^^^^
    ../../FlutterProjects/SDK/flutter/packages/flutter_localizations/lib/src/material_localizations.dart:550:7: Error: Method 'replaceFirst' cannot be called on 'String?' because it is potentially null.
    Try calling using ?. instead.
        ).replaceFirst(r'$licenseCount', formatDecimal(licenseCount));
          ^^^^^^^^^^^^
    ../../FlutterProjects/SDK/flutter/packages/flutter_localizations/lib/src/material_localizations.dart:659:7: Error: Method 'replaceFirst' cannot be called on 'String?' because it is potentially null.
    Try calling using ?. instead.
        ).replaceFirst(r'$remainingCount', formatDecimal(remainingCount));
          ^^^^^^^^^^^^
    ../../../.pub-cache/hosted/pub.dartlang.org/chewie-0.9.10/lib/src/chewie_player.dart:83:7: Error: No named parameter with the name 'resizeToAvoidBottomPadding'.
          resizeToAvoidBottomPadding: false,
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
    ../../FlutterProjects/SDK/flutter/packages/flutter/lib/src/material/scaffold.dart:1437:9: Context: Found this candidate, but the arguments don't match.
      const Scaffold({
            ^^^^^^^^
    ../../../.pub-cache/hosted/pub.dartlang.org/chewie-0.9.10/lib/src/chewie_player.dart:276:17: Error: The method 'inheritFromWidgetOfExactType' isn't defined for the class 'BuildContext'.
     - 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('../../FlutterProjects/SDK/flutter/packages/flutter/lib/src/widgets/framework.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'inheritFromWidgetOfExactType'.
            context.inheritFromWidgetOfExactType(_ChewieControllerProvider)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Failed to compile application.

以下是我的颤振医生输出:

[✓] Flutter (Channel master, 1.26.0-2.0.pre.419, on macOS 11.1 20C69 darwin-x64, locale en-GB)
    • Flutter version 1.26.0-2.0.pre.419 at /Users/sanket/Desktop/FlutterProjects/SDK/flutter
    • Framework revision 913d5933c1 (4 hours ago), 2021-01-19 22:34:03 -0800
    • Engine revision b58dbc88fc
    • Dart version 2.12.0 (build 2.12.0-240.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/sanket/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • ANDROID_HOME = /Users/sanket/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[!] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode2.app/Contents/Developer
    • Xcode 12.0, Build version 12A7209
    ! Xcode 12.0.0 out of date (12.0.1 is recommended).
      Download the latest version or update via the Mac App Store.
    • CocoaPods version 1.10.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      ? https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      ? https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] Connected device (2 available)
    • AOSP on IA Emulator (mobile) • emulator-5554 • android-x86    • Android 9 (API 28) (emulator)
    • Chrome (web)                 • chrome        • web-javascript • Google Chrome 87.0.4280.141

! Doctor found issues in 1 category.
Process finished with exit code 0

enter image description here

请帮我解决这个错误,我的应用程序之前在浏览器中运行,但我不知道它何时停止工作。

我尝试升级 flutter 和 dart 版本以解决此问题,但仍然无法正常工作。

3 个答案:

答案 0 :(得分:4)

我遇到了同样的错误,我尝试了

flutter clean

然后

dart pub upgrade

用于依赖项升级。

然后它开始工作,您只需在项目的 pubspec.yml 文件中点击 Android Studio 中的 Pub Upgrade。

答案 1 :(得分:1)

美好的一天。请参阅 https://github.com/i-protoss/wave/issues/30 中的解决方案:

将此添加到您的 pubspec.yaml

wave: 
 git: 
  url: git://github.com/searchy2/wave.git

答案 2 :(得分:-4)

我已经解决了这个问题,购买降级到 1.22.6 的 Flutter Dart 版本。

此外,在 Podfile #platform :ios, '9.0'platform :ios, '9.0' 中,在 Xcode 中转到应用程序 Runner > Flutter > AppFrameworkInfo.plist 并更改 minimumOSVersion to 9.0

之后按相同顺序运行以下命令:

 1. flutter clean
 2. flutter pub get
 3. flutter run

一切就绪,项目正在运行,没有任何错误。

相关问题