Dart by Example: Libraries

libraries are imported using the import keyword:

1. // app.dart

3. library app;

5. import 'utils.dart';

7. main() {
8. print(shout('Welcome'));
9. print(whisper('Welcome'));
10. }

libraries can be split into parts using the part and part of syntax:

1. // utils.dart

3. library utils;

5. part 'whisper.dart';

7. String shout(String inp) => inp.toUpperCase() + '!!!';
1. // whisper.dart

3. part of utils;

5. String whisper(String inp) => inp.toLowerCase() + '...';
1. $ app.dart
2. WELCOME!!!
3. welcome...

by @jryanio | source | license