Use Flutter- library

For the development of the project, it is important modular, modular talked about, you need to use the library, in the Dart, the use of the library is introduced by import keyword

import 'package:flutter/material.dart';

Which importfollowed afterwards URI library path format example above is: package:schemewhere is the scheme provided by the packet specified by the library manager in the Flutter, pub by Dart tool management pack.

The above embodiment is the introduction of external libraries, library for internal, DART path format is: dart:scheme, example is shown below:

import 'dart:io';

For the same package the following dart libraries, as we have main.dartthe following added a testFile.dartfile, we need to introduce when it can be used directly introduced by a relative path:

import 'testFile.dart';

In the library, execute the command pubspec.yaml need to reference the statement flutter packages getbe pulled can be used.

Guess you like

Origin www.cnblogs.com/jinlongyu123/p/11628230.html