Structuring an application
All Dart projects that are meant to be used in a production environment should follow best software engineering practices and hence, must contain a particular structure of folders. A well-structured project breathes professionalism and gives developers a sense of recognition; it is much easier to find your way in a standardized structure. Moreover, it is also necessary if you want to use a bunch of application-specific libraries in your app, as we will see in the next recipe.
Getting ready
An app that is meant to run on its own, either as a command-line application or a web application, is an application package; it needs a main()
entry point. A library package will be used as a dependency in other apps. All Dart projects depend on the configuration file pubspec.yaml
, which describes the app and its dependencies, together with the pubspec.lock
file. This dictates which libraries will be contained in the top-level packages
folder. This file and the packages
folder...