[FIXED] Invalid depfile: Flutter

Issue

I am following a tutorial from a udemy course and recently I built a new pc so the hard drive that stored my code is secondary right now. When I compile the code, it gives me the following error. To explain it better, I am posting a picture of one warning in my code but I am pretty sure it is an error flutter is making as it usually does with imports. Error in Code
I have tried running a test app by making a default app from cmd and that works fine. So obviously, flutter doctor shows no error. the error is repetitive and long so I am pasting some of it below.

The error-

Invalid depfile: D:\WorkSpace\Code\Flutter\Image App\image_app\.dart_tool\flutter_build\8f0d0eee9ef614ed024ca7691a333af8\kernel_snapshot.d
Invalid depfile: D:\WorkSpace\Code\Flutter\Image App\image_app\.dart_tool\flutter_build\8f0d0eee9ef614ed024ca7691a333af8\kernel_snapshot.d

Compiler message:
Error: Could not resolve the package 'http' in 'package:http/http.dart'.
lib/src/app.dart:5:8: Error: Expected ';' after this.
import 'widgets/image_list.dart;'
       ^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/src/app.dart:2:8: Error: Not found: 'package:http/http.dart'
import 'package:http/http.dart' show get; //Only need get so we only care about one Get fuction
       ^
lib/src/app.dart:5:8: Error: Error when reading 'lib/src/widgets/image_list.dart;': The system cannot find the file specified.

import 'widgets/image_list.dart;'
       ^
/C:/src/flutter/packages/flutter/lib/src/material/bottom_navigation_bar.dart:9:8: Error: Error when reading '/C:/Users/dluck/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/vector_math-2.0.8/lib/vector_math_64.dart': The system cannot find the path specified.

import 'package:vector_math/vector_math_64.dart' show Vector3;
       ^
/C:/src/flutter/packages/flutter/lib/widgets.dart:15:1: Error: Error when reading '/C:/Users/dluck/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/vector_math-2.0.8/lib/vector_math_64.dart': The system cannot find the path specified.

export 'package:vector_math/vector_math_64.dart' show Matrix4;
^
/C:/src/flutter/packages/flutter/lib/rendering.dart:31:1: Error: Error when reading '/C:/Users/dluck/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/vector_math-2.0.8/lib/vector_math_64.dart': The system cannot find the path specified.

export 'package:vector_math/vector_math_64.dart' show Matrix4;
^
/C:/src/flutter/packages/flutter/lib/src/widgets/implicit_animations.dart:8:8: Error: Error when reading '/C:/Users/dluck/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/vector_math-2.0.8/lib/vector_math_64.dart': The system cannot find the path specified.

import 'package:vector_math/vector_math_64.dart';
       ^
/C:/src/flutter/packages/flutter/lib/src/widgets/transitions.dart:8:8: Error: Error when reading '/C:/Users/dluck/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/vector_math-2.0.8/lib/vector_math_64.dart': The system cannot find the path specified.

import 'package:vector_math/vector_math_64.dart' show Matrix4;
       ^
/C:/src/flutter/packages/flutter/lib/src/widgets/widget_inspector.dart:27:8: Error: Error when reading '/C:/Users/dluck/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/vector_math-2.0.8/lib/vector_math_64.dart': The system cannot find the path specified.

import 'package:vector_math/vector_math_64.dart';
       ^
/C:/src/flutter/packages/flutter/lib/foundation.dart:12:1: Error: Error when reading '/C:/Users/dluck/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/meta-1.1.8/lib/meta.dart': The system cannot find the path specified.

C:/src/flutter/packages/flutter/lib/src/foundation/node.dart:90:4: Error: Getter not found: 'mustCallSuper'.
  @mustCallSuper
   ^^^^^^^^^^^^^
/C:/src/flutter/packages/flutter/lib/src/foundation/node.dart:90:4: Error: This can't be used as metadata; metadata should be a reference to a compile-time constant variable, or a call to a constant constructor.
  @mustCallSuper
   ^
/C:/src/flutter/packages/flutter/lib/src/foundation/node.dart:104:4: Error: Getter not found: 'mustCallSuper'.
  @mustCallSuper
   ^^^^^^^^^^^^^
/C:/src/flutter/packages/flutter/lib/src/foundation/node.dart:104:4: Error: This can't be used as metadata; metadata should be a reference to a compile-time constant variable, or a call to a constant constructor.
  @mustCallSuper
   ^
/C:/src/flutter/packages/flutter/lib/src/foundation/node.dart:118:4: Error: Getter not found: 'protected'.
  @protected
   ^^^^^^^^^
/C:/src/flutter/packages/flutter/lib/src/foundation/node.dart:118:4: Error: This can't be used as metadata; metadata should be a reference to a compile-time constant variable, or a call to a constant constructor.
  @protected
   ^
/C:/src/flutter/packages/flutter/lib/src/foundation/node.dart:119:4: Error: Getter not found: 'mustCallSuper'.
  @mustCallSuper
   ^^^^^^^^^^^^^
/C:/src/flutter/packages/flutter/lib/src/foundation/node.dart:119:4: Error: This can't be used as metadata; metadata should be a reference to a compile-time constant variable, or a call to a constant constructor.
  @mustCallSuper
   ^
/C:/src/flutter/packages/flutter/lib/src/foundation/node.dart:139:4: Error: Getter not found: 'protected'.
  @protected
   ^^^^^^^^^

C:/src/flutter/packages/flutter/lib/src/semantics/semantics.dart:3970:4: Error: This can't be used as metadata; metadata should be a reference to a compile-time constant variable, or a call to a constant constructor.
  @required TextDirection thisTextDirection,
   ^
/C:/src/flutter/packages/flutter/lib/src/semantics/semantics.dart:3971:4: Error: Getter not found: 'required'.
  @required TextDirection otherTextDirection,
   ^^^^^^^^
/C:/src/flutter/packages/flutter/lib/src/semantics/semantics.dart:3971:4: Error: This can't be used as metadata; metadata should be a reference to a compile-time constant variable, or a call to a constant constructor.
  @required TextDirection otherTextDirection,
   ^
U
nhandled exception:
FileSystemException(uri=org-dartlang-untranslatable-uri:
package%3Ahttp%2Fhttp.dart; message=StandardFileSystem only supports file:* and data:* URIs)
#0      StandardFi
leSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:33:7)
#1      asFileU
ri (package:vm/kernel_front_end.dart:604:37)
#
2      writeDepfile (package:vm/kernel_front
_end.dart:799:21)
<asynchronous suspension>
#
3      FrontendCompiler.compile (package:fron
tend_server/frontend_server.dart:472:15)
<asynchronous 
suspension>
#4      _FlutterFrontendCompiler.comp
ile (package:flutter_frontend_server/server.dar
t:38:22)
#5      starter (package:flutter_fronte
nd_server/server.dart:149:27)
#6      main (f
ile:///C:/b/s/w/ir/cache/builder/src/flutter/fl
utter_frontend_server/bin/starter.dart:8:30)
#7    
  _startIsolate.<anonymous closure> (dart:isol
ate-patch/isolate_patch.dart:305:32)
#8      _RawRec
eivePortImpl._handleMessage (dart:isolate-patch
/isolate_patch.dart:174:12)

Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.

FAILURE: Build failed with an exception.

* Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 780

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\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 6s
Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

Solution

Okay so I found out since I changed the PC, I needed to change permissions of a file.
Follow here
https://github.com/simolus3/moor/issues/224

Answered By – GreenCodeSki

Answer Checked By – Marie Seifert (Easybugfix Admin)

Leave a Reply

(*) Required, Your email will not be published