Dart before learning the language, you must understand these important concepts.

Foreword

Google Dart is developed computer programming language, was later Ecma (ECMA-408) identified as standard. It was developed for the field of the Web, servers, and networking and other mobile applications. It is open source software under liberal open source license (BSD modified certificate).

Dart is object-oriented, class definition, single inheritance language. Language syntax similar to C, can be translated into the JavaScript, to support the interface (the interfaces), mixed (as mixins), an abstract class (abstract classes), the specific generics (reified generics), alternative type (optional typing) and sound type system .

Everything Objects

Object class: it is the base class for all objects Dart . Because Object is the root of the hierarchy Dart class, subclass Dart all other classes are Object.

In Dart, whether it is a string type or Null, an object is stored in any variable (Object), all objects are instances of a class (Class) corresponds, and all objects inherited from class Object.

Strongly-typed

Precisely, Dart belong to a strongly typed language, that is, before declaring variables must determine the type of the variable. But note that, Dart also can automatically infer the type, like JavaScript, like, you do not need to declare a variable of type. So the type of comment is optional, if you want to explicitly does not require any type, you need to use a special type of dynamic.

Support for generics

Dart generic support, such as List <int> (list of integers) or a List <dynamic> (a list of objects of any kind).

Support for top-level function

Dart top support functions, such as main (), bound to the same function or object class (static functions and are examples of the function). And create a function (nested or local functions) within a support function.

Support for top-level variable

Similarly, the top support Dart variables, the variables bound to the same class or object (static variables and instance variables), sometimes referred to as instance variables, or attributes fields.

Libraries and visibility

Unlike Java, Dart no keywords public / protected / private. If the identifier begins with an underscore, it is relative to the library is private. Identifier is a letter or underscore (_) at the beginning, followed by any combination of letters and numbers.

Keyword

Avoid using these words as identifiers. However, if necessary, marked on the subject of keywords can be used as identifiers:

  1. 1 with the target word for the context keyword only has meaning in a particular location. They are valid identifier anywhere.
  2. With 2 built-identifier word on the subject, in order to simplify the JavaScript code to Dart's work, in most places these keywords are valid identifier, but they can not be used as a class or type name can not be used as import prefix.
  3. Word on the subject with asynchronous 3 is added and the Dart 1.0 release supports the related updates, as a restricted reserved words. You can not use any function of the body await mark async, async * or sync * or in yield as an identifier.

Keyword table remaining words are reserved words. Reserved words can not be used as identifiers.

Here Insert Picture Description

hello world

void main(){
	print("hello world!");
}

Dart online editor

Portal, click Run to run the code.

Published 237 original articles · won praise 338 · views 760 000 +

Guess you like

Origin blog.csdn.net/weixin_44198965/article/details/103867620