Frontend/Dart,Flutter

    Dart 시작하기 - Classes

    | Dart 시작하기 - Classes https://nomadcoders.co/dart-for-beginners/lectures/4113 1. Class - 생성자 X class Player { final String name = 'Hong'; int xp = 100; void sayHello(){ // this.name 처럼 this를 사용하지 않아도 된다. print("The name is $name"); } } void main() { var player1 = new Player(); print(player1.name); player1.xp = 120; print(player1.xp); // player1.name = 'change'; --> Error! (final이 들어가면 바꿀 수 없음) p..

    Dart 시작하기 - Optional Positional Parameter, QQ operator, Typedef

    | Dart 시작하기 - Optional Positional Parameter, QQ operator, Typedef https://nomadcoders.co/dart-for-beginners/lectures/4112 void main() { // Optional Positional Parameter (선택적) print(sayHello('hong', 12)); // QQ Operator : ??, ?= print(capitalizeName('hong')); print(capitalizeName(null)); print(capitalizeName2(null)); String? name; name ??= 'empty'; // name이 null이면 'emtpy'를 반환하라. name ??= 'another..

    Dart 시작하기 - 함수, Named Parameters

    | Dart 시작하기 - 함수, Named Parameters void main() { print(sayHello('potato')); print(sayHello2('potato')); print(plus(1, 10)); } // 함수 String sayHello(String name){ return "Hello, $name! It is nice to meet you~~!!"; } // 한줄 짜리면 fat arrow syntax를 사용해서 한 방에 만들 수도 있다. String sayHello2(String name) => "Hello, $name! It is nice to meet you~~!!"; num plus(num a, num b) => a + b; void main() { // print(sa..

    Dart 시작하기 - 데이터 타입

    | Dart 시작하기 - 데이터 타입 https://nomadcoders.co/dart-for-beginners/lectures/4106 void main() { // Basic variables String name = 'Hong'; bool alive = true; // int, double 모두 num 을 extends 했다. int number = 0; double money = 12.11; num versitile = 10; versitile = 12.11; // Lists var numbers = [1, 2, 3, 4, 5]; numbers.add(6); List list = [1, 2, 3, 4, 5]; list.add(6); // -- 배열을 초기화할 때 조건문을 넣어줄 수 있다. var ..

    Dart 시작하기 - 변수

    | Dart 시작하기 - 변수 https://nomadcoders.co/dart-for-beginners/lectures/4099 1. var 변수 - 컴파일 시에 자동으로 타입 변환된다. (권장되는 사항) *var 에 그렇다고 null을 넣을 수는 없음 2. dynamic 변수 - 타입 변환이 가능하다. (조심스럽게 사용해야 한다) 3. nullable 변수 - 타입 뒤에 ?을 붙이면 된다. 4. final 변수 - 변경 불가 제어자. 타입 없이 바로 값을 넣으면 컴파일 시 타입 지정이 된다.. 5. late 변수 - 나중에 초기화가 가능하게 하는 제어자 (ex. late final String name;) 6. constant 변수 - 컴파일 시에 반드시 값을 알고 있어야 하는 변수. (반드시 초기화..