O'Reilly logo

Dart: Scalable Application Development by Ivo Balbaert, Sergey Akopkokhyants, Davy Mitchell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using a library from within your app

As indicated in the previous recipe, every kind of app can contain a lib folder, which at the very least contains the model classes. These model classes are very important because they form the backbone of your project, so they must be accessible in your entire application. You can do this by placing them at the top in a lib folder, or even better in the lib/model. This central position will also make them stand out and easy to find for other readers of your code.

How to do it...

Take a look at the structure of the bank_terminal project. The model classes Person and BankAccount are placed in the lib\model folder. Give your project a name in the pubspec.yaml file:

name: bank_terminal

Then, use the same name for ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required