8
votes

Depfile non valide: Flutter

Je suis un tutoriel d'un cours udemy et récemment j'ai construit un nouveau PC donc le disque dur qui stockait mon code est secondaire pour le moment. Lorsque je compile le code, cela me donne l'erreur suivante. Pour mieux l'expliquer, je poste une image d'un avertissement dans mon code, mais je suis presque sûr que c'est une erreur qui se produit, comme cela se produit habituellement avec les importations. Erreur dans le code J'ai essayé d'exécuter une application de test en créant une application par défaut à partir de cmd et cela fonctionne bien. Alors évidemment, Flutter Doctor ne montre aucune erreur. l'erreur est répétitive et longue, donc j'en colle une partie ci-dessous.

L'erreur-

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)


1 commentaires

Avez-vous essayé la commande "flutter pub get"? Parce qu'il semble que l'un de vos packages n'a pas été trouvé.


5 Réponses :


4
votes

D'accord, j'ai découvert que depuis que j'ai changé de PC, j'avais besoin de modifier les autorisations d'un fichier. Suivez ici https://github.com/simolus3/moor/issues/224


0 commentaires

11
votes

J'ai eu la même erreur et je suis également un cours udemy.
J'ai essayé le flutter pub get et ça a marché.


0 commentaires

6
votes

J'ai également fait face au même problème et je trie en exécutant la commande "flutter clean". https://github.com/flutter/flutter/issues/21053


0 commentaires

3
votes

vous devez nettoyer le projet, exécuter "Flutter Clean" dans le projet et exécuter plus tard le projet normal


0 commentaires

0
votes

C'est un problème vraiment simple, tout ce que vous avez à faire est d'aller dans le terminal ci-dessous et de taper flutter clean et c'est tout.


0 commentaires