What does this "Invalid depfile" error mean and how do I fix it?

I’ve been teaching myself Flutter the past couple of months and made a simple app that translates English input into Morse code. It worked great! I decided to go back and tinker with it the other day, and the only thing I changed was adding a new Padding widget that contains a TextField child. There are no initial errors in the code that I can see…

Padding(
      padding: EdgeInsets.all(16.0),
      child: TextField(
        decoration: InputDecoration(hintText: 'Input here'),
        style: TextStyle(
          fontSize: 15,
          color: Colors.black,
        ),
      ),
    ),

However, when I run it I get this massive error (see attached image). I have the top half as well, but the forum would only let me post one screenshot.

Invalid depfile: /filePath/ .dart_tool/flutter_build/b3f8bc0aa94bb70d2ac0ad4dc55117d8/kernel_snapshot.d
Error: Could not resolve the package ‘characters’ in ‘packaage:character/characters.dart’.
/…/…/flutter/packages/flutter/lib/src/material/text_field.dart:9:8: Error: Not found: ‘package:characters/characters.dart’
import ‘package:characters/characters.dart’;

I’m still fairly new to coding, so I don’t fully understand what it is or how to begin fixing it. I did update Flutter before this happened but when I run flutter doctor it says that everything is fine?? I’m not using xcode, so I haven’t been overly concerned about that.

What does this “Invalid depfile” error mean and how do I fix it?

Doctor summary (to see all details, run flutter doctor -v):

[✓] Flutter (Channel stable, 1.20.1, on Mac OS X 10.12.6 16G2136, locale en-US)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
[✗] Xcode - develop for iOS and macOS
✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
Download at: https://developer.apple.com/xcode/download/
Or install Xcode via the App Store.
Once installed, run:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
✗ CocoaPods not installed.
CocoaPods is used to retrieve the iOS and macOS platform side’s plugin code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To install:
sudo gem install cocoapods
[✓] Android Studio (version 4.0)
[✓] Connected device (1 available)

! Doctor found issues in 1 category.

.

It seems that you have a typo there:

packaage has an exceeding “a” character.
Try fixing that in your pubspec.yaml

1 Like

Hmm, the error wouldn’t copy and paste so I typed that part in by hand. I just doubled checked, and in the error it’s ‘package’ with one ‘a’. I must’ve mistyped it when writing my question.
Thank you for catching that, though!!

Oh, I see, sorry then. Are you sure you have defined the dependency in your pubspec.yaml file, i.e.

dependencies:
  characters: ^1.0.0

and installed with pub get?

Hth

Reading your problem description and searching for the exception shown in the screenshot I could find the above mentioned issue reported in flutter repo.

Most them of have run into this problem after updating and they could resolve it by using the latest version of the package and then running flutter clean.

You should probably try doing the same, let us know if that fixes your issue.