Tutorial by Examples

Use import to specify how a namespace from one library is used in the scope of another library. import 'dart:html'; The only required argument to import is a URI specifying the library. For built-in libraries, the URI has the special dart: scheme. For other libraries, you can use a file system p...
Unlike Java, Dart doesn’t have the keywords public, protected, and private. If an identifier starts with an underscore _, it’s private to its library. If you for example have class A in a separate library file (eg, other.dart), such as: library other; class A { int _private = 0; testA()...
If you import two libraries that have conflicting identifiers, then you can specify a prefix for one or both libraries. For example, if library1 and library2 both have an Element class, then you might have code like this: import 'package:lib1/lib1.dart'; import 'package:lib2/lib2.dart' as lib2; /...
If you want to use only part of a library, you can selectively import the library. For example: // Import only foo and bar. import 'package:lib1/lib1.dart' show foo, bar; // Import all names EXCEPT foo. import 'package:lib2/lib2.dart' hide foo;
Deferred loading (also called lazy loading) allows an application to load a library on demand, if and when it’s needed. To lazily load a library, you must first import it using deferred as. import 'package:deferred/hello.dart' deferred as hello; When you need the library, invoke loadLibrary() us...

Page 1 of 1