Getting error while upgrade the flutter version 2.0

Issue

I getting an error while trying to run the flutter app in a web browser.

Following is the output that I am getting while running the app :

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.

Following is my flutter doctor output:

[✓] 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

Please help me out to solve this error, My app earlier running in the browser but I don’t know when it stopped working.

I tried to upgrade the flutter and dart version to solve this issue but still not working.

Solution

I was getting the same error and I tried

flutter clean

and then

dart pub upgrade

for the Dependencies upgrade.

and then it started working you can just click on the Pub Upgrade in Android studio in pubspec.yml file of your projects.

Answered By – Muhammad Ashir

Answer Checked By – Marilyn (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *