App packages vs Lib packages

Photo by Jiawei Zhao on Unsplash

App packages vs Lib packages

What is the difference?

Application packages are packages that contain application-specific code. These packages are typically used to create a single application and are not expected to be reused in multiple projects. Application packages contain everything needed to build and run an application, including the pubspec.yaml file, the pubspec.lock file (generated by the flutter packages get command), the application source code, and any other files or resources needed to build the application.

On the other hand, library packages are packages that contain code that can be used in various projects. These packages usually contain one or more Dart libraries that can be imported and used in other Flutter projects. Library packages are usually published in the Flutter package repository so that other developers can use them. Library packages contain the pubspec.yaml file, the source code for the library, and any other files or resources needed to build the library. However, library packages do not include the pubspec.lock file, as this can cause version conflicts when using the library package in different projects.