Sobes.tech
Junior — Middle

What is the difference between separating dependencies into main and development in project configuration files?

sobes.tech AI

Answer from AI

In Flutter configuration files (for example, in pubspec.yaml), dependencies are divided into main (dependencies) and development (dev_dependencies):

  • Main dependencies (dependencies) are packages necessary for the app to run in production. They are included in the final build and used within the app itself.

  • Development dependencies (dev_dependencies) are packages needed only during development, testing, building, or code generation. They are not included in the final app build.

For example, packages for unit testing, linting, or code generation are usually specified in dev_dependencies.

An example from pubspec.yaml:

dependencies:
  flutter:
    sdk: flutter
  http: ^0.13.0

dev_dependencies:
  flutter_test:
    sdk: flutter
  build_runner: ^2.0.0

This separation helps reduce the size of the final application and clearly delineates what is needed for operation and what is only for development.

What is the difference between separating… - sobes.tech