当前位置:网站首页>Dart basic notes
Dart basic notes
2022-06-30 09:02:00 【Silent Pinocchio】
Dart Basics
- dynamic The assignment type can be changed
- var If initialization determines the type , Cannot be changed halfway
- Static type is better than dynamic type High execution efficiency
- final The value cannot be modified , The runtime determines
- const Compile time determines
- final Variables can use const Variable assignment
- dart Can be taken as java Medium int and long Use , If dart More than the 4 Bytes will Translate it into int perhaps long , otherwise Translate it into shot perhaps int
- ??= Sentenced to empty
- … Cascade The operator , It can achieve something similar builder Design patterns
- ? Security operator
- Optional position parameters : There is no need to write a bunch of overloaded functions , You can also provide default values
Method
- Underline names represent externally invisible
- The class name is not visible outside the beginning of the underscore
- Name the construction method
- Parameter initialization list
class Test {
// Not visible from the outside
late int _x;
Test(int a, int b);
// Name the construction method
Test.a(int c) : this(c, 0);
// Parameter initialization list
Test.fromMap(Map map) :_x = map["x"],_y = map["y"];
}
- Use new There is no difference between creating an object and a normal object
Use const Create multiple objects , Parameters are the same , This object is a compiler constant object ( Constant constructor must be defined ) - Factory construction method
First, set the default constructor
Then call the named constructor to return the constructor instance
Factory methods must return instance objects
static Method needs to display the declaration return object , Or no return
class Manager {
// Factory construction method
factory Manager.get() {
return new Manager();
}
Manager();
}
- get and set Method
var x1 = new Xl();
x1.x = 1;
print(x1._x);
- operators overloading
class Xl {
late int _x;
int get x => _x;
set x(int x) => _x = x;
// operators overloading
Xl operator +(Xl other) {
var xl = new Xl();
xl._x = _x + other._x;
return xl;
}
}
- Each class can be viewed as an interface , It can be realized
- with Keywords can be mixed with other classes ( Although there is no official document stating that it is multi inheritance , I think it can be understood as multiple inheritance )
class A {
void a() {
}
}
class B {
void b() {
}
}
//C class Mixed up A Classes and B class
class C with A, B {
void c() {
}
}
class D = Object with A, B;
void main(){
//C You can directly call the mixed class to break the law
var c = new C();
c.a();
c.b();
c.c();
}
- Method if conflict The priority of the call : First call C ,C No, Call again B ,A,with Post mixed classes Look backwards
- super You can call the functions of the parent class
If there is a problem , Welcome to point out
边栏推荐
- Evaluation standard for audio signal quality of intelligent speakers
- Summary of common pytoch APIs
- Detailed explanation of pytoch's scatter function
- Unity simple shader
- Flink Sql -- toAppendStream doesn‘t support consuming update and delete changes which
- Detailed explanation of rect class
- Design specification for smart speakers v1.0
- Flink Exception -- No ExecutorFactory found to execute the application
- C#訪問SQL Server數據庫兩種方式的比較(SqlDataReader vs SqlDataAdapter)
- vite項目require語法兼容問題解决require is not defined
猜你喜欢

Interviewer: do you understand the principle of recyclerview layout animation?

Opencv learning notes -day 11 (split() channel separation function and merge() channel merge function)

Opencv learning notes -day13 pixel value statistics calculation of maximum and minimum values, average values and standard deviations (use of minmaxloc() and meanstddev() functions)

C#访问MongoDB并执行CRUD操作

Rew acoustic test (III): generate test signal

Opencv learning notes -day2 (implemented by the color space conversion function cvtcolar(), and imwrite image saving function imwrite())

Interpretation of orientedrcnn papers

Opencv learning notes -day10 logical operation of image pixels (usage of rectangle function and rect function and bit related operation in openCV)

Maxiouassigner of mmdet line by line interpretation

Redis design and Implementation (I) | data structure & object
随机推荐
Tidb 6.0: making Tso more efficient tidb Book rush
Esp32 (6): Bluetooth and WiFi functions for function development
Mmdet line by line code interpretation of positive and negative sample sampler
CUDA implements matrix replication
127.0.0.1, 0.0.0.0 and localhost
C#访问MongoDB并执行CRUD操作
Opencv learning notes-day9 opencv's own color table operation (colormap coloraptypes enumeration data types and applycolormap() pseudo color function)
[protobuf] protobuf generates cc/h file through proto file
Opencv learning notes -day4 image pixel reading and writing operations (array traversal and pointer traversal implementation, uchar vec3b data type and mat class functions mat:: at(), mat:: ptr())
El input limit can only input numbers
Metasploit practice - SSH brute force cracking process
[untitled]
Rew acoustic test (V): equipment required for test
mysql基础入门 day4 动力节点[老杜]课堂笔记
Set, map and modularity
Flink Exception -- No ExecutorFactory found to execute the application
Redis design and Implementation (VI) | cluster (sharding)
100 lines of code and a voice conversation assistant
Resnet50+fpn for mmdet line by line code interpretation
Axure make menu bar effect