본문 바로가기

Flutter5

Dart with (Mixin) 이해하기 클래스를 상속받는 것 외에 with를 통해 다른 클래스의 멤버 변수와 멤버 함수를 사용할 수 있습니다. with (Mixin)을 사용해 다른 클래스의 멤버 함수를 사용해보겠습니다. class Human { String name; int age; Human({ required this.name, required this.age, }); void intro() { print("My name is $name and I'm $age years old."); } } class Student extends Human with highScore{ final int number; Student({ required String name, required int age, required this.number, }) : s.. 2023. 1. 7.
Dart Inheritance & override 이해하기 Dart의 상속에 대해서 이해해보겠습니다. 먼저 Human Class를 생성합니다. Human 클래스는 이름과 나이를 나타내는 멤버 변수로 가지고 있습니다. class Human { String name; int age; Human({ required this.name, required this.age, }); void intro() { print("My name is $name and I'm $age years old."); } } 다음은 Human 클래스를 상속받은 Student 클래스를 생성합니다. Student 클래스는 학생ID를 나타내는 number 라는 멤버 변수를 하나 더 가지고 있습니다. class Student extends Human { final int number; Student({.. 2023. 1. 6.
Dart Cascade Notation Cascade Notation에 알아보기 위해 먼저 클래스를 생성하고 그 값을 변경하는 코드를 작성하겠습니다. class Human { String name; int age; String hair; Human({ required this.name, required this.age, required this.hair, }); void intro() { print("My name is $name and I'm $age years old. My hair-color is $hair"); } } void main() { var human = Human(name: 'name', age: 20, hair: 'gold'); human.age = 21; human.hair = 'silver'; human.name = '.. 2023. 1. 5.
Flutter firebase_analytics 사용하기 우선 플러터를 파이어베이스에 연동합니다. 연동 방법은 지난 게시글을 확인해주세요. 플러터 안드로이드 파이어베이스 연동하기 플러터 안드로이드 파이어베이스 연동하기 플러터를 파이어베이스에 연동하는 법을 알아보겠습니다. flutter firebase 연동하기 사이트 접속 부터 하나씩 다루면서 진행해볼게요 우선 구글 계정으로 파이어베이스 페이지에 접속하여 프로젝 bebestberich.tistory.com 그럼 Flutter에서 Firebase를 사용하기 위해 pubspec.yaml에 firebase_core (파이어베이스 기본 패키지)와 firebase_analytics (파이어베이스 애널리틱스 패키지)를 설치합니다. 아래 링크에서 버전 확인 후에 버전 설치해주세요 https://pub.dev/packages.. 2022. 11. 18.