Created
February 10, 2019 22:45
-
-
Save VB10/412e95a640d03b5ab6670bce884d5e7a to your computer and use it in GitHub Desktop.
Dart 101 App.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import './hardwareandro.dart'; | |
void main() { | |
var val1 = "string1"; | |
String val2 = "string2,asdasd"; | |
int _int1 = 15; | |
var int1 = 5; | |
bool _bool = true; | |
bool bool_ = false; | |
List<int> _list = [1, 2, 3]; | |
var list = ["adasd", 1, false]; | |
// print(val1); | |
// print(_int1); | |
// print("${list[0]} ${int1}"); | |
var _split = val2.split(","); | |
var _toString = int1.toString(); | |
if (_int1 > 0) { | |
// print("okey"); | |
} else { | |
// print("false"); | |
} | |
bool isOkey = _list.length > 0 ? true : false; | |
// print(isOkey); | |
for (var item in _list) { | |
// print(item.toString()); | |
} | |
for (var i = 0; i < int1; i++) { | |
// print(i); | |
} | |
sum(5, 10); | |
var total = _sum(4, 32); | |
print(total); | |
/** | |
* final use runtime & immutable veriable | |
*/ | |
final _final1 = DateTime.now(); | |
/** | |
* const use commpiler time && immutable | |
*/ | |
const _const1 = 12; | |
var hwa1 = new HardwareAndro("videoTitle", "author", 15); | |
hwa1.channel = 6; | |
print(6); | |
var hwa2 = new HardwareAndro.MyCustructor("asdasd"); | |
// print(hwa2.videoTitle); | |
// print(hwa2.number); | |
} | |
// void sum(int val1, int val2) { | |
// print("result : ${(val1 + val2)}"); | |
// } | |
/** | |
* optional param | |
*/ | |
sum(int val1, [int val2]) { | |
print("result : ${(val1 + val2)}"); | |
} | |
// int _sum(int val1, int val2) { | |
// } | |
/** | |
* return value | |
*/ | |
_sum(int val1, int val2) { | |
return val1 + val2; | |
} | |
/** | |
* arrow function | |
*/ | |
// sum(int val1, [int val2]) => print("result : ${(val1 + val2)}"); | |
// _sum(int val1, int val2) => val1 + val2; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment