SlideShare a Scribd company logo
플러터에 파이어베이스 한스푼
Jae Young Ahn
@goodahn
Table of Contents 🐦
1. Firebase Overview
🚩 Firebase가 뭔지 조금 알아!
1. Hands-on
🚩 Firebase 연동이 두렵지 않아!
인증, 데이터베이스, 푸시 알람, 스토리지 등의 기능을 제공해주는
관리형 개발 플랫폼
Firebase?
https://firebase.google.com/docs?authuser=0&hl=ko
인증, 데이터베이스, 푸시 알람, 스토리지 등의 기능을 제공해주는
관리형 개발 플랫폼
Firebase?
https://firebase.google.com/docs?authuser=0&hl=ko
Simple Meetup App
- 간단한 채팅 기능을
위한 Firebase 설정
https://github.com/goodahn/tutorial-firebase-with-flutter
1. 정상적으로 실행되는지 확인하기
2. Firebase 프로젝트 생성하기
● https://console.firebase.google.com/
● “프로젝트 추가 버튼” 클릭
● “Google 애널리틱스 사용 설정” off
3. “이메일/비밀번호” 인증 기능 활성화
● “Build(빌드)”탭에서 “Authentication” 클릭
● “Sign-in method”의 “Email/Password” 사용
4. Cloud Firestore 기능 활성화
● “Build(빌드)”탭에서 “Cloud Firestore” 클릭
● “Create database(데이터베이스 만들기)” 클릭
● “Start in test mode(테스트 모드에서 시작)” 클릭
● 다중 지역 “asia-northeast3” 선택
5. firebase 관련 라이브러리 설치 및 설정
// 프로젝트 루트 디렉토리에서 다음 명령어 실행
flutter pub add firebase_core
flutter pub add firebase_auth
flutter pub add cloud_firestore
flutter pub add provider
dart pub global activate flutterfire_cli
flutterfire configure // 4번 슬라이드에서 생성한 파이어베이스 프로젝트 선택
6. 메시지 작성을 위한 보안 규칙 설정
https://firebase.google.com/docs/firestore/security/rules-conditions?hl=ko&authuser=0
// lib/main.dart
_guestBookSubscription = FirebaseFirestore.instance
.collection('guestbook')
.orderBy('timestamp', descending: true)
.snapshots()
.listen((snapshot) {
…
…
});
6.1 메시지 작성을 위한 보안 규칙 설정
https://firebase.google.com/docs/firestore/security/rules-conditions?hl=ko&authuser=0
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /guestbook/{entry} {
allow read: if true;
allow write: if true;
}
}
}
6.2 메시지 작성을 위한 보안 규칙 설정
https://firebase.google.com/docs/firestore/security/rules-conditions?hl=ko&authuser=0
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /guestbook/{entry} {
allow read: if request.auth.uid != null;
allow write:
if request.auth.uid == request.resource.data.userId
&& "name" in request.resource.data
&& "text" in request.resource.data
&& "timestamp" in request.resource.data;
}
}
}
7. 출석 체크를 위한 보안 규칙 설정
// lib/main.dart
_attendingSubscription = FirebaseFirestore.instance
.collection('attendees')
.doc(user.uid)
.snapshots()
.listen((snapshot) {
…
});
7.1 출석 체크를 위한 보안 규칙 설정
rules_version = '2';
service cloud.firestore {
…
match /attendees/{userId} {
allow read: if true;
allow write: if true;
}
}
}
7.2 출석 체크를 위한 보안 규칙 설정
rules_version = '2';
service cloud.firestore {
…
match /attendees/{userId} {
allow read: if true;
allow write: if request.auth.uid == userId
&& "attending" in request.resource.data;
}
}
}
8. 메시지 오른쪽에 삭제 버튼 추가하기
# lib/main.dart
// TODO: 메시지 옆에 삭제 버튼을 삽입해보세요.
9. 삭제 버튼 눌렀을 때, 메시지 삭제시키기
# lib/main.dart
// TODO: 메시지가 눌렸을 때, 실제 firestore의 다큐멘트를 지우는 코드를 작성해보세요!
Hands-on
😎😎😎
😎😎😎
😎😎😎

More Related Content

PPTX
Flutter & Firebase
PPTX
GMS 프로젝트 - Flutter
PDF
파이어베이스 네이버 밋업발표
PPTX
Flutter & Firebase (2) Kitworks Team Study
PDF
Firebase for web (웹개발을 위한 파이어베이스) 3 Real-Time Database
PPTX
Firestore
PDF
파이어베이스 스터디
PPTX
1. 개발환경 셋팅
Flutter & Firebase
GMS 프로젝트 - Flutter
파이어베이스 네이버 밋업발표
Flutter & Firebase (2) Kitworks Team Study
Firebase for web (웹개발을 위한 파이어베이스) 3 Real-Time Database
Firestore
파이어베이스 스터디
1. 개발환경 셋팅

Similar to [GDG 대전] Flutter에 Firebase 한스푼 - GDG Flutter Festival (12)

PDF
[Google I_O Extended Daejeon 2023] 처음 시작하는 Flutter
PDF
[2022]Flutter_IO_Extended_Korea_멀티모듈을활용한플러터클린아키텍처_...
PDF
Abcd 2016 firebase
PDF
Firebase for web (웹개발을 위한 파이어베이스) 2 Authentication
PDF
Firebase를 이용한 호우호우 미니게임 만들기
PDF
FIrebase를 이용한 호우호우 미니게임 만들기
PDF
Google Firebase로 레고블럭 조립하기 - IO Extended 2016
PDF
파이어베이스를 이용한 모바일 앱 개발
PDF
[NEXT] Flask 로 Restful API 서버 만들기
PDF
슬로우캠퍼스 - 안드로이드 개발자들이여 Firebase로 날아보자 :)
PDF
Flutter로 글로벌앱 출시를 위한 꿀팁 - Droidknights2020
PDF
Massive service basic
[Google I_O Extended Daejeon 2023] 처음 시작하는 Flutter
[2022]Flutter_IO_Extended_Korea_멀티모듈을활용한플러터클린아키텍처_...
Abcd 2016 firebase
Firebase for web (웹개발을 위한 파이어베이스) 2 Authentication
Firebase를 이용한 호우호우 미니게임 만들기
FIrebase를 이용한 호우호우 미니게임 만들기
Google Firebase로 레고블럭 조립하기 - IO Extended 2016
파이어베이스를 이용한 모바일 앱 개발
[NEXT] Flask 로 Restful API 서버 만들기
슬로우캠퍼스 - 안드로이드 개발자들이여 Firebase로 날아보자 :)
Flutter로 글로벌앱 출시를 위한 꿀팁 - Droidknights2020
Massive service basic
Ad

More from DEVELOPER.NET (11)

PPTX
EDA 맛보기 (Event Driven Architecture)
PPTX
[GDG 대전 IO Extended 22] 생산성 향상을 위한 원포인트툴_ Cloud Code
PPTX
1. github action을 활용한 CI
PPTX
0. CI_CD 툴에 대한 오해
PPTX
[GDG 대전] 자율주행로봇 서버는 어떻게 구성되어 있나 - 주니어들 개발자들의 우당탕탕 서버 개발기
PPTX
2. aws 네트워크 (2)
PPTX
2. aws 네트워크 (1)
PPTX
2. aws 네트워크 (0)
PPTX
1. Docker Network (1)
PPTX
1. Docker Network (0)
PPTX
0. 네트워크 공부의 필요성
EDA 맛보기 (Event Driven Architecture)
[GDG 대전 IO Extended 22] 생산성 향상을 위한 원포인트툴_ Cloud Code
1. github action을 활용한 CI
0. CI_CD 툴에 대한 오해
[GDG 대전] 자율주행로봇 서버는 어떻게 구성되어 있나 - 주니어들 개발자들의 우당탕탕 서버 개발기
2. aws 네트워크 (2)
2. aws 네트워크 (1)
2. aws 네트워크 (0)
1. Docker Network (1)
1. Docker Network (0)
0. 네트워크 공부의 필요성
Ad

[GDG 대전] Flutter에 Firebase 한스푼 - GDG Flutter Festival

  • 2. Table of Contents 🐦 1. Firebase Overview 🚩 Firebase가 뭔지 조금 알아! 1. Hands-on 🚩 Firebase 연동이 두렵지 않아!
  • 3. 인증, 데이터베이스, 푸시 알람, 스토리지 등의 기능을 제공해주는 관리형 개발 플랫폼 Firebase? https://firebase.google.com/docs?authuser=0&hl=ko
  • 4. 인증, 데이터베이스, 푸시 알람, 스토리지 등의 기능을 제공해주는 관리형 개발 플랫폼 Firebase? https://firebase.google.com/docs?authuser=0&hl=ko
  • 5. Simple Meetup App - 간단한 채팅 기능을 위한 Firebase 설정
  • 8. 2. Firebase 프로젝트 생성하기 ● https://console.firebase.google.com/ ● “프로젝트 추가 버튼” 클릭 ● “Google 애널리틱스 사용 설정” off
  • 9. 3. “이메일/비밀번호” 인증 기능 활성화 ● “Build(빌드)”탭에서 “Authentication” 클릭 ● “Sign-in method”의 “Email/Password” 사용
  • 10. 4. Cloud Firestore 기능 활성화 ● “Build(빌드)”탭에서 “Cloud Firestore” 클릭 ● “Create database(데이터베이스 만들기)” 클릭 ● “Start in test mode(테스트 모드에서 시작)” 클릭 ● 다중 지역 “asia-northeast3” 선택
  • 11. 5. firebase 관련 라이브러리 설치 및 설정 // 프로젝트 루트 디렉토리에서 다음 명령어 실행 flutter pub add firebase_core flutter pub add firebase_auth flutter pub add cloud_firestore flutter pub add provider dart pub global activate flutterfire_cli flutterfire configure // 4번 슬라이드에서 생성한 파이어베이스 프로젝트 선택
  • 12. 6. 메시지 작성을 위한 보안 규칙 설정 https://firebase.google.com/docs/firestore/security/rules-conditions?hl=ko&authuser=0 // lib/main.dart _guestBookSubscription = FirebaseFirestore.instance .collection('guestbook') .orderBy('timestamp', descending: true) .snapshots() .listen((snapshot) { … … });
  • 13. 6.1 메시지 작성을 위한 보안 규칙 설정 https://firebase.google.com/docs/firestore/security/rules-conditions?hl=ko&authuser=0 rules_version = '2'; service cloud.firestore { match /databases/{database}/documents { match /guestbook/{entry} { allow read: if true; allow write: if true; } } }
  • 14. 6.2 메시지 작성을 위한 보안 규칙 설정 https://firebase.google.com/docs/firestore/security/rules-conditions?hl=ko&authuser=0 rules_version = '2'; service cloud.firestore { match /databases/{database}/documents { match /guestbook/{entry} { allow read: if request.auth.uid != null; allow write: if request.auth.uid == request.resource.data.userId && "name" in request.resource.data && "text" in request.resource.data && "timestamp" in request.resource.data; } } }
  • 15. 7. 출석 체크를 위한 보안 규칙 설정 // lib/main.dart _attendingSubscription = FirebaseFirestore.instance .collection('attendees') .doc(user.uid) .snapshots() .listen((snapshot) { … });
  • 16. 7.1 출석 체크를 위한 보안 규칙 설정 rules_version = '2'; service cloud.firestore { … match /attendees/{userId} { allow read: if true; allow write: if true; } } }
  • 17. 7.2 출석 체크를 위한 보안 규칙 설정 rules_version = '2'; service cloud.firestore { … match /attendees/{userId} { allow read: if true; allow write: if request.auth.uid == userId && "attending" in request.resource.data; } } }
  • 18. 8. 메시지 오른쪽에 삭제 버튼 추가하기 # lib/main.dart // TODO: 메시지 옆에 삭제 버튼을 삽입해보세요.
  • 19. 9. 삭제 버튼 눌렀을 때, 메시지 삭제시키기 # lib/main.dart // TODO: 메시지가 눌렸을 때, 실제 firestore의 다큐멘트를 지우는 코드를 작성해보세요!