Flutter:How to solve system can not find the path Specified

3,473

I had this issue as well and came about several situations that could cause it.

First one: It could be a broken path in your env variables. You can check all paths by doing a simple "echo %PATH%" in your terminal and removing those that don't point to a valid location.

Second one: Make sure that your project path doesn't include an '&' as stated on this issue here: https://github.com/flutter/flutter/issues/41547

Third one: Another one that I found is that after uninstalling Anaconda it left out an AutoRun key in the command processor registry (in your case it may have been Firebase).

Check these places in regedit for broken links: Computer\HKEY_CURRENT_USER\Software\Microsoft\Command Processor Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor

Share:
3,473
Yeabsira Ashenafi
Author by

Yeabsira Ashenafi

Updated on December 28, 2022

Comments

  • Yeabsira Ashenafi
    Yeabsira Ashenafi over 1 year

    I have been working on a flutter app and recently installed three firebase related pacakges firebase_core,cloud_firestore and firebase_storage. But after installation when I try to import them in a .dart file I am facing 'The system cannot find the path specified

    import 'package:quiver/core.dart';' error. So what should I do ,here is my pubspec.yaml file . I even tried adding quiver to the pubspec.yaml if that could fix the erro but it didn't.

    name: bookecommerceapp
    description: A new Flutter project.
    
    # The following defines the version and build number for your application.
    # A version number is three numbers separated by dots, like 1.2.43
    # followed by an optional build number separated by a +.
    # Both the version and the builder number may be overridden in flutter
    # build by specifying --build-name and --build-number, respectively.
    # In Android, build-name is used as versionName while build-number used as versionCode.
    # Read more about Android versioning at https://developer.android.com/studio/publish/versioning
    # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
    # Read more about iOS versioning at
    # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
    version: 1.22.6
    
    environment:
      sdk: ">=2.1.0 <3.0.0"
    
    dependencies:
      flutter:
        sdk: flutter
    
      # The following adds the Cupertino Icons font to your application.
      # Use with the CupertinoIcons class for iOS style icons.
      cupertino_icons: ^0.1.2
      google_fonts: any
      http: ^0.12.2
      provider: ^4.3.3
      search_page: ^1.4.0
      loading: ^1.0.2
      file_picker: ^2.1.6
      firebase_core: ^0.7.0
      cloud_firestore: ^0.16.0+1
      firebase_storage: ^7.0.0
      quiver: ^2.1.5
    
    
    dev_dependencies:
      flutter_test:
        sdk: flutter
    
    
    # For information on the generic Dart part of this file, see the
    # following page: https://dart.dev/tools/pub/pubspec
    
    # The following section is specific to Flutter.
    flutter:
    
      # The following line ensures that the Material Icons font is
      # included with your application, so that you can use the icons in
      # the material Icons class.
      uses-material-design: true
    
      # To add assets to your application, add an assets section, like this:
      assets:
        - images/
        - google_fonts/
    #    - imagesa_dot_ham.jpeg
    
      # An image asset can refer to one or more resolution-specific "variants", see
      # https://flutter.dev/assets-and-images/#resolution-aware.
    
      # For details regarding adding assets from package dependencies, see
      # https://flutter.dev/assets-and-images/#from-packages
    
      # To add custom fonts to your application, add a fonts section here,
      # in this "flutter" section. Each entry in this list should have a
      # "family" key with the font family name, and a "fonts" key with a
      # list giving the asset and other descriptors for the font. For
      # example:
      # fonts:
      #   - family: Schyler
      #     fonts:
      #       - asset: fonts/Schyler-Regular.ttf
      #       - asset: fonts/Schyler-Italic.ttf
      #         style: italic
      #   - family: Trajan Pro
      fonts:
        - family: OpenSans
          fonts:
            - asset: google_fonts/OpenSans-Bold.ttf
            - asset: google_fonts/OpenSans-Bolditalic.ttf
            - asset: google_fonts/OpenSans-ExtraBold.ttf
            - asset: google_fonts/OpenSans-ExtraBoldItalic.ttf
            - asset: google_fonts/OpenSans-Light.ttf
            - asset: google_fonts/OpenSans-Regular.ttf
    
      #
      # For details regarding fonts from package dependencies,
      # see https://flutter.dev/custom-fonts/#from-packages
    
    

    and here is my full error stacktrace

    Performing hot reload...
    Syncing files to device Android SDK built for x86...
    /C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_storage-7.0.0/lib/firebase_storage.dart:11:8: Error: Error when reading '/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/quiver-2.1.5/lib/core.dart': The system cannot find the path specified.
    
    import 'package:quiver/core.dart';
           ^
    /C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.7.0/lib/firebase_core.dart:10:8: Error: Error when reading '/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/quiver-2.1.5/lib/core.dart': The system cannot find the path specified.
    
    import 'package:quiver/core.dart';
           ^
    /C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_platform_interface-3.0.1/lib/firebase_core_platform_interface.dart:15:8: Error: Error when reading '/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/quiver-2.1.5/lib/core.dart': The system cannot find the path specified.
    
    import 'package:quiver/core.dart';
           ^
    /C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_storage-7.0.0/lib/src/firebase_storage.dart:168:23: Error: The method 'hash2' isn't defined for the class 'FirebaseStorage'.
     - 'FirebaseStorage' is from 'package:firebase_storage/firebase_storage.dart' ('/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_storage-7.0.0/lib/firebase_storage.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'hash2'.
      int get hashCode => hash2(app.name, bucket);
                          ^^^^^
    /C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_storage-7.0.0/lib/src/reference.dart:211:23: Error: The method 'hash2' isn't defined for the class 'Reference'.
     - 'Reference' is from 'package:firebase_storage/firebase_storage.dart' ('/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_storage-7.0.0/lib/firebase_storage.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'hash2'.
      int get hashCode => hash2(storage, fullPath);
                          ^^^^^
    /C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_storage-7.0.0/lib/src/task_snapshot.dart:49:23: Error: The method 'hash2' isn't defined for the class 'TaskSnapshot'.
     - 'TaskSnapshot' is from 'package:firebase_storage/firebase_storage.dart' ('/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_storage-7.0.0/lib/firebase_storage.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'hash2'.
      int get hashCode => hash2(storage, ref);
                          ^^^^^
    /C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.7.0/lib/src/firebase_app.dart:65:23: Error: The method 'hash2' isn't defined for the class 'FirebaseApp'.
     - 'FirebaseApp' is from 'package:firebase_core/firebase_core.dart' ('/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.7.0/lib/firebase_core.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'hash2'.
      int get hashCode => hash2(name, options);
                          ^^^^^
    /C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_platform_interface-3.0.1/lib/src/firebase_exception.dart:63:12: Error: The method 'hash3' isn't defined for the class 'FirebaseException'.
     - 'FirebaseException' is from 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart' ('/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_platform_interface-3.0.1/lib/firebase_core_platform_interface.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'hash3'.
        return hash3(plugin, code, message);
               ^^^^^
    /C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_platform_interface-3.0.1/lib/src/firebase_options.dart:183:12: Error: The method 'hashObjects' isn't defined for the class 'FirebaseOptions'.
     - 'FirebaseOptions' is from 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart' ('/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_platform_interface-3.0.1/lib/firebase_core_platform_interface.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'hashObjects'.
        return hashObjects(asMap.entries);
               ^^^^^^^^^^^
    /C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_platform_interface-3.0.1/lib/src/platform_interface/platform_interface_firebase_app.dart:64:23: Error: The method 'hash2' isn't defined for the class 'FirebaseAppPlatform'.
     - 'FirebaseAppPlatform' is from 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart' ('/C:/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_platform_interface-3.0.1/lib/firebase_core_platform_interface.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'hash2'.
      int get hashCode => hash2(name, options);
                          ^^^^^
    

    P.s The error happens when I only import it in any file like this

    import 'package:firebase_storage/firebase_storage.dart';
    
    • Bach
      Bach about 3 years
      hash2() is from quiver package that's not related to the firebase packages. Did you put import 'package:quiver/core.dart'; in your file? Btw, you'll need to run flutter pub get then rebuild your app after adding a new package. Hot reload won't allow you to use the new package immediately
    • Yeabsira Ashenafi
      Yeabsira Ashenafi about 3 years
      I tried that and did not work . I even to create another app and showed me the same error message so I re-installed flutter and it is working now.
    • Yeabsira Ashenafi
      Yeabsira Ashenafi almost 3 years
      Problem was solved when upgrading the flutter version and clearing the cache.
  • Abdulaziz Tayyar
    Abdulaziz Tayyar almost 3 years
    Thank you. The (Third one) fixed my problem .