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

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

챗봇 시작해보기
챗봇 시작해보기챗봇 시작해보기
챗봇 시작해보기
성일 한
 
[Koss Con 2016] CloudBread Tutorial PT
[Koss Con 2016] CloudBread Tutorial PT[Koss Con 2016] CloudBread Tutorial PT
[Koss Con 2016] CloudBread Tutorial PT
윤석 홍
 
Team project(with reactnative)
Team project(with reactnative)Team project(with reactnative)
Team project(with reactnative)
형석 장
 
[네이버오픈소스세미나] Next Generation Spring Security OAuth2.0 - 이명현
[네이버오픈소스세미나] Next Generation Spring Security OAuth2.0 - 이명현[네이버오픈소스세미나] Next Generation Spring Security OAuth2.0 - 이명현
[네이버오픈소스세미나] Next Generation Spring Security OAuth2.0 - 이명현
NAVER Engineering
 
Couchbase .net client 개발
Couchbase .net client 개발Couchbase .net client 개발
Couchbase .net client 개발
세진 김
 
Couchbase .net client 개발
Couchbase .net client 개발Couchbase .net client 개발
Couchbase .net client 개발
jr p
 
생산성을 높여주는 iOS 개발 방법들.pdf
생산성을 높여주는 iOS 개발 방법들.pdf생산성을 높여주는 iOS 개발 방법들.pdf
생산성을 높여주는 iOS 개발 방법들.pdf
ssuserb942d2
 
JBoss EAP on Azure
JBoss EAP on Azure JBoss EAP on Azure
JBoss EAP on Azure
rockplace
 
모바일 게임과 앱을 위한 오픈소스 게임서버 엔진 프로젝트 CloudBread 프로젝트
모바일 게임과 앱을 위한 오픈소스 게임서버 엔진 프로젝트 CloudBread 프로젝트모바일 게임과 앱을 위한 오픈소스 게임서버 엔진 프로젝트 CloudBread 프로젝트
모바일 게임과 앱을 위한 오픈소스 게임서버 엔진 프로젝트 CloudBread 프로젝트
Dae Kim
 
안드로이드에서 Baasio 서비스 이용하기
안드로이드에서 Baasio 서비스 이용하기 안드로이드에서 Baasio 서비스 이용하기
안드로이드에서 Baasio 서비스 이용하기
고포릿 default
 
Amazed by aws 2nd session
Amazed by aws 2nd sessionAmazed by aws 2nd session
Amazed by aws 2nd session
Amazon Web Services Korea
 
Spring-Boot (springcamp2014)
Spring-Boot (springcamp2014)Spring-Boot (springcamp2014)
Spring-Boot (springcamp2014)
sung yong jung
 
IoT with Raspberry Pi + Node JS - Chapter 3
IoT with Raspberry Pi + Node JS - Chapter 3IoT with Raspberry Pi + Node JS - Chapter 3
IoT with Raspberry Pi + Node JS - Chapter 3Park Jonggun
 
Nest js 101
Nest js 101Nest js 101
Nest js 101
Daniel Lim
 
Open stack swift 디버깅 시작하기
Open stack swift 디버깅 시작하기Open stack swift 디버깅 시작하기
Open stack swift 디버깅 시작하기
영우 김
 
AWS Meetup 프리젠테이션.pdf
AWS Meetup 프리젠테이션.pdfAWS Meetup 프리젠테이션.pdf
AWS Meetup 프리젠테이션.pdf
AlexLee226686
 
파이어베이스 네이버 밋업발표
파이어베이스 네이버 밋업발표파이어베이스 네이버 밋업발표
파이어베이스 네이버 밋업발표
NAVER D2
 
REST API Development with Spring
REST API Development with SpringREST API Development with Spring
REST API Development with Spring
Keesun Baik
 
Data discovery & metadata management (amundsen installation)
Data discovery & metadata management (amundsen installation)Data discovery & metadata management (amundsen installation)
Data discovery & metadata management (amundsen installation)
창언 정
 

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

챗봇 시작해보기
챗봇 시작해보기챗봇 시작해보기
챗봇 시작해보기
 
[Koss Con 2016] CloudBread Tutorial PT
[Koss Con 2016] CloudBread Tutorial PT[Koss Con 2016] CloudBread Tutorial PT
[Koss Con 2016] CloudBread Tutorial PT
 
Team project(with reactnative)
Team project(with reactnative)Team project(with reactnative)
Team project(with reactnative)
 
[네이버오픈소스세미나] Next Generation Spring Security OAuth2.0 - 이명현
[네이버오픈소스세미나] Next Generation Spring Security OAuth2.0 - 이명현[네이버오픈소스세미나] Next Generation Spring Security OAuth2.0 - 이명현
[네이버오픈소스세미나] Next Generation Spring Security OAuth2.0 - 이명현
 
Couchbase .net client 개발
Couchbase .net client 개발Couchbase .net client 개발
Couchbase .net client 개발
 
Couchbase .net client 개발
Couchbase .net client 개발Couchbase .net client 개발
Couchbase .net client 개발
 
생산성을 높여주는 iOS 개발 방법들.pdf
생산성을 높여주는 iOS 개발 방법들.pdf생산성을 높여주는 iOS 개발 방법들.pdf
생산성을 높여주는 iOS 개발 방법들.pdf
 
JBoss EAP on Azure
JBoss EAP on Azure JBoss EAP on Azure
JBoss EAP on Azure
 
모바일 게임과 앱을 위한 오픈소스 게임서버 엔진 프로젝트 CloudBread 프로젝트
모바일 게임과 앱을 위한 오픈소스 게임서버 엔진 프로젝트 CloudBread 프로젝트모바일 게임과 앱을 위한 오픈소스 게임서버 엔진 프로젝트 CloudBread 프로젝트
모바일 게임과 앱을 위한 오픈소스 게임서버 엔진 프로젝트 CloudBread 프로젝트
 
안드로이드에서 Baasio 서비스 이용하기
안드로이드에서 Baasio 서비스 이용하기 안드로이드에서 Baasio 서비스 이용하기
안드로이드에서 Baasio 서비스 이용하기
 
7. html5 api
7. html5 api7. html5 api
7. html5 api
 
Amazed by aws 2nd session
Amazed by aws 2nd sessionAmazed by aws 2nd session
Amazed by aws 2nd session
 
Spring-Boot (springcamp2014)
Spring-Boot (springcamp2014)Spring-Boot (springcamp2014)
Spring-Boot (springcamp2014)
 
IoT with Raspberry Pi + Node JS - Chapter 3
IoT with Raspberry Pi + Node JS - Chapter 3IoT with Raspberry Pi + Node JS - Chapter 3
IoT with Raspberry Pi + Node JS - Chapter 3
 
Nest js 101
Nest js 101Nest js 101
Nest js 101
 
Open stack swift 디버깅 시작하기
Open stack swift 디버깅 시작하기Open stack swift 디버깅 시작하기
Open stack swift 디버깅 시작하기
 
AWS Meetup 프리젠테이션.pdf
AWS Meetup 프리젠테이션.pdfAWS Meetup 프리젠테이션.pdf
AWS Meetup 프리젠테이션.pdf
 
파이어베이스 네이버 밋업발표
파이어베이스 네이버 밋업발표파이어베이스 네이버 밋업발표
파이어베이스 네이버 밋업발표
 
REST API Development with Spring
REST API Development with SpringREST API Development with Spring
REST API Development with Spring
 
Data discovery & metadata management (amundsen installation)
Data discovery & metadata management (amundsen installation)Data discovery & metadata management (amundsen installation)
Data discovery & metadata management (amundsen installation)
 

More from DEVELOPER.NET

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

More from DEVELOPER.NET (11)

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

[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의 다큐멘트를 지우는 코드를 작성해보세요!