본문 바로가기

프로그래밍/Flutter-Dart76

[Flutter] Dart 문법 (async, Future, await, then) * 비동기 - 아래 printWithDelay함수에서 await를 빼고 실행시키면 Future.delayed와 print가 동시에 실행되는 듯 하고, await을 넣고 실행시키면 delay가 적용된 후에 print가 실행된다. //Future : An object representing a delayed computation. //async : async 함수 본문 앞에 키워드 사용하여 비동기로 표시 //await : async 내에서 작동하는 기능. Future printWithDelay(Duration delay, String message) async { await Future.delayed(delay); print(message); } Future printWithDelay2() async { v.. 2021. 3. 15.
[Flutter] Dart 문법 (abstract, implement) * 추상클래스, implement : 추상클래스 및 일반 클래스 implement 가능. - implement하면 클래스가 구현해 둔 메서드도 재정의 해야할 강제성이 생김. (일반 메서드도 구현해야 함) class Spacecraft extends Describable { String? name; DateTime? launchDate; //Constructor, with syntactic sugar for assignment to members. Spacecraft(this.name, this.launchDate) { //Initialization code goes here. } Spacecraft.origin() { name = "무탈리스크"; launchDate = DateTime.now(); } /.. 2021. 3. 15.
[Flutter] Dart 문법 (상속) * 상속 class Spacecraft { String? name; DateTime? launchDate; //Constructor, with syntactic sugar for assignment to members. Spacecraft(this.name, this.launchDate) { //Initialization code goes here. } Spacecraft.origin() { name = "무탈리스크"; launchDate = DateTime.now(); } //Named contructor that forwards to the default one. Spacecraft.unlaunched(String name) : this(name, null); int? get launchYear =>.. 2021. 3. 15.
[Flutter] Dart 문법 (class, ?, !, ?.) * 클래스 ?, !, ?.등 각각이 의미하는 바를 파악하지 못해서 너무 헤맸지만 의미를 알고나니 코드가 이해가 갔다... class Spacecraft { // ? : 개체가 null일 수 있음 String? name; DateTime? launchDate; //Constructor, with syntactic sugar for assignment to members. Spacecraft(this.name, this.launchDate) { //Initialization code goes here. } Spacecraft.origin() { name = "무탈리스크"; launchDate = DateTime.now(); } //Named contructor that forwards to the defau.. 2021. 3. 15.
[Flutter] Dart 문법 (변수, 함수, 화살표 함수, 조건문, 반복문) * 변수 : 모든 변수들이 Calss 안에 있을 필요는 없다!! var name = 'Voyager I'; var year = 1977; var antennaDiameter = 3.7; var flybyObjects = ['Jupiter', 'Saturn', 'Uranus', 'Neptune']; var image = { 'tags': ['saturn'], 'url': '//path/to/saturn.jpg' }; class TestCalss { var fruit = "apple"; var num = 5; var sub_fruit = ['banana', "orange"]; } void main() { print(name); print(year); print(antennaDiameter); print(fl.. 2021. 3. 15.
[Flutter] flutter 윈도우 설치 https://cording-cossk3.tistory.com/101 [Flutter] IOS 앱 구동 (1) android studio로 개발하던 프로젝트를 맥으로 가져와서 빌드하려고 했더니, Downloads Dart SDK 였나? 라고 뜨길래 다운받으려고 링크를 타고 들어갔다. dart.dev/get-dart $ brew tap dart-lang/dart $ brew install dart cording-cossk3.tistory.com https://cording-cossk3.tistory.com/102 [Flutter] IOS 앱 구동 (2) flutter 프로젝트로 이동하자 그리고 ios 프로젝트를 열어준다. 그럼 xcode가 실행이 될 것이다!! 왼쪽에 project 구조에서 Runner를 .. 2021. 3. 15.