Chapter 1 - about the file: pubspec.lock & .packages

Hi, I create a Dart project with Dart SDK 2.17.1, there are two more files: 1. pubspec.lock and .package.

Could you also explain briefly what these files are?

@mattjgalloway any suggestions?

The .packages file was a Dart Package Configuration File. A new file has replaced it package_config.json now located in .dart_tool subdirectory. The file is generated, not for manual editing. Some information about the file can be found on the following linked page language/ at master · dart-lang/language · GitHub

The lockfile is generated automatically as well, to ensure that you can recreate the exact configuration of packages used by an application. It locks down the version numbers and contains more information than the standard pubspec.


Thank you! I will finish this book asap and then go to learn flutter development.

1 Like

Hope your progressing nicely with the books!

An update to my previous post:
In the upcoming Dart 3.18.0 release, the .packages will no longer be created.

Relevant part from the Dart change log:

dart pub get and dart pub upgrade no longer creates the deprecated .packages file. It can still be created with the --legacy-packages-file flag.


Hi Laura, thank you. I progress slowly on the book. Now, I am reading chapter 4.