Libraries in Dart
Libraries teaches you to use code that is already written.
In this chapter, you will:
- import Dart's own libraries, like
dart:mathanddart:convert - use prefixes,
showandhideto control what you import - split your own code into libraries, and keep names private with
_ - add community packages from pub.dev with
dart pub
What each lesson covers:
- Libraries: How to import Dart's own libraries with prefixes, show and hide, split your code into your own libraries with private names, and add packages from pub.dev with pubspec.yaml and dart pub.
This chapter has 1 lesson. Plan on about 25 minutes, with 6 exercises to check what you learned. Every example is real Dart code: change it, run it again and compare the output, which is the fastest way to learn how each feature behaves.
Simple lesson: finish this chapter and you never have to write a square root or a date formatter yourself.
Lessons in this section
- Libraries
How to import Dart's own libraries with prefixes, show and hide, split your code into your own libraries with private names, and add packages from pub.dev with pubspec.yaml and dart pub.
- Import core libraries with prefixes, show and hide
- Write your own libraries and keep names private with _
- Add and use packages from pub.dev