| Type | Description | Example |
|---|---|---|
| int | Integer (whole number) | int a = 10; |
| double | Floating-point number | double b = 3.14; |
| num | Supertype of int and double | num x = 5.5; |
| String | Text (UTF-16 string) | String s = "Hello"; |
| bool | Boolean (true/false) | bool isOk = true; |
| Type | Description | Example |
|---|---|---|
| List | Ordered collection | List<int> nums = [1,2,3]; |
| Set | Unordered unique collection | Set<int> s = {1,2,3}; |
| Map | Key-value pairs | Map<String,int> m = {"a":1}; |
| Type | Description | Example |
|---|---|---|
| dynamic | Can hold any type | dynamic x = "Hello"; |
| Object | Base class of all types | Object obj = 10; |
| Object? | Nullable object | Object? obj = null; |
| Null | Represents null value | Null n = null; |
| Type | Description | Example |
|---|---|---|
| Function | Function as variable | Function f = () {}; |
| Custom Function | Specific function signature | int Function(int,int) |
| Type | Description | Example |
|---|---|---|
| Record | Multiple values (tuple-like) | (int, String) r = (1, "A"); |
| Enum | Fixed set of constants | enum Color {red, blue} |
| typedef | Type alias | typedef MyInt = int; |
| Type | Description | Example |
|---|---|---|
| int? | Nullable integer | int? a = null; |
| String? | Nullable string | String? s; |
| Keyword | Description |
|---|---|
| var | Type inferred automatically |
| final | Single assignment |
| const | Compile-time constant |
| Operator | Name | Description | Example | Result |
|---|---|---|---|---|
| + | Addition | Adds two values | 3 + 6 | 9 |
| - | Subtraction | Subtracts two values | 7 - 5 | 2 |
| * | Multiplication | Multiplies two values | 3 * 2 | 6 |
| / | Division | Returns double result | 7/3 | 2 |
| ~/ | Integer Division | Returns integer result | 5 ~/ 3 | 1 |
| % | Modulo | Remainder of division | 5 % 3 | 2 |
| Operator | Name | Description | Example Code | Result |
|---|---|---|---|---|
| ++a | Pre-increment | Increase value before using it |
int a = 5; int b = ++a; |
a = 6, b = 6 |
| a++ | Post-increment | Use value first, then increase |
int a = 5; int b = a++; |
a = 6, b = 5 |
| --a | Pre-decrement | Decrease value before using it |
int a = 5; int b = --a; |
a = 4, b = 4 |
| a-- | Post-decrement | Use value first, then decrease |
int a = 5; int b = a--; |
a = 4, b = 5 |
| Operator | Name | Description | Example |
|---|---|---|---|
| = | Assign | Assign value | a = 10 |
| += | Add & Assign | a = a + b | a += b |
| -= | Subtract & Assign | a = a - b | a -= b |
| *= | Multiply & Assign | a = a * b | a *= b |
| /= | Divide & Assign | a = a / b | a /= b |
| ~/= | Int Divide Assign | a = a ~/ b | a ~/= b |
| %= | Modulo Assign | a = a % b | a %= b |
| ??= | Null Assign | Assign if null | a ??= b |
| Operator | Name | Example |
|---|---|---|
| == | Equal | a == b |
| != | Not Equal | a != b |
| > | Greater Than | a > b |
| < | Less Than | a < b |
| >= | Greater or Equal | a >= b |
| <= | Less or Equal | a <= b |
| Operator | Name | Description | Example |
|---|---|---|---|
| && | AND | True if both true | a && b |
| || | OR | True if one is true | a || b |
| ! | NOT | Negates condition | !a |
| Operator | Name | Description | Example |
|---|---|---|---|
| is | Type Test | True if object has type | a is String |
| is! | Not Type | True if not type | a is! int |
| Operator | Name | Description | Example |
|---|---|---|---|
| ?? | If Null | Return right if left is null | a ?? b |
| ?. | Null-aware Access | Access if not null | a?.length |
| ! | Null Assertion | Force non-null | a!.length |
| Operator | Name | Description | Example |
|---|---|---|---|
| .. | Cascade | Chain multiple calls | obj..a()..b() |
| ?.. | Null-aware Cascade | Cascade if not null | obj?..a() |
| Operator | Name | Description | Example |
|---|---|---|---|
| [] | Index | Access element | list[0] |
| []= | Index Assign | Assign element | list[0] = 1 |
| . | Member Access | Access property | obj.name |
| ?[] | Null-aware Index | Safe index access | list?[0] |
| ... | Spread | Spread elements | [...list] |
| ...? | Null-aware Spread | Spread if not null | [...?list] |