Book Image

Dart By Example

By : David Mitchell
Book Image

Dart By Example

By: David Mitchell

Overview of this book

Table of Contents (17 chapters)
Dart By Example
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Building the dialog package


The pub packaging system is a great resource for sharing finished packages online. If we want to keep a package local and private, we can create it locally and use it in much the same manner.

The package project structure

The package project is structured in a similar manner to a web application project, with a pubspec.yaml file being the main project file. Instead of a web folder, there is a lib folder containing the simple_dialog.dart file that declares our library and defines what is exposed outside the project:

This file contains any classes, functions, and references to other files—in this case, the two files in the src folder. The first line in simple_dialog.dart with the keyword library states the name and declares that this is a library. Note that it is not surrounded by any quotation marks:

library simple_dialog;
import 'dart:html';
part 'src/dialog_base.dart';
part 'src/prefabs.dart';

The next section contains the imports required for all the files that are...