
| Dart Web | Dart Native |
|---|---|
| translates Dart code into js | translates Dart code to various architectures of CPU. |
Compiling for an Architecture(MacOS, Windows, etc) takes a lot of time.
The most well-known compiler type is AOT.
AOT(Ahead of Time): You compile first, then distribute the resulting binary(CPU understandable). This means that you have to compile the whole project to see the result every time you make a change.
JIT(Just in Time): Will show you the results of your code right away, using the dart VM. Because this means that code is running on vm, it means that it will take more time running your code, only during development.
| Under development | After developing |
|---|---|
| JIT(Dart VM) | AOT |
Referencing a null value invokes serious crash issues, and so Dart chose to apply this feature.
Flutter chose Dart because 1. Dart has both AOT and JIT, which makes it so much easier to build a mobile app. 2. Also, Dart and Flutter are both powered by Google, so Google is able to optimized Dart for Flutter.
※ Dart 문법에서는 세미콜론(;)이 사용되기도 하고 사용되지 않기도 하기 때문에 유의해서 코딩해야 한다.
var (변수 이름); // dynamic (변수 이름); 과 같다.
(변수 이름) = moni;
(변수 이름) = 12;
(변수 이름) = true;
Example:
void main() {
dynamic name;
if(name is String) {
name.length… ;
}
if(name is int) {
name.isFinite… ;
}
// 인터넷에서 데이터를 가져왔는데 타입을 모를 경우, dart가 데이터 타입을 확인할 수 있도록 도와줄 수 있다.