Chapter 5. Understanding libraries and privacy

 

This chapter covers

  • Organizing your code into reusable packages
  • Importing libraries into your application
  • Hiding functionality with library privacy
  • Using multiple source files
  • Using scripts as runnable libraries

Most programming languages have a library structure that allows code to be split over multiple files and published to other developers, which promotes modularity and code reuse and improves the ability of developers to work on different parts of the same codebase by hiding the internal implementation of a library. Dart is no exception; but in Dart, the library mechanism also has a big impact on privacy, especially class and function privacy. In languages such as Java and C#, privacy is centered around the class; but in Dart, this privacy exists at the library level rather than the class level. That’s why we’re discussing libraries and privacy this early in this book.

5.1. Defining and importing libraries in your code

5.2. Hiding functionality with library privacy

5.3. Organizing library source code

5.4. Packaging your libraries

5.5. Scripts are runnable libraries

5.6. Summary

sitemap