기본 셋팅이후에 두번째 시간으로 FIRESTORE 에 대한 셋팅과 쿼리(CRUD) 절차.
참고: SQL DB 와 Firestore 차이
| Sql DB | Cloud Firestore | 비고 |
| 데이타베이스 컨넥션 ->테이블 쿼리(필드명 이용) |
컬렉션 컨넥션 ->문서.필드명 쿼리 |
참고사이트: https://firebase.google.com/docs/firestore
Firestore | Firebase
Google Cloud 인프라를 기반으로 하는 유연하고 확장 가능한 NoSQL 클라우드 데이터베이스를 사용해 클라이언트 측 개발 및 서버 측 개발에 사용되는 데이터를 저장하고 동기화하세요.
firebase.google.com
모델 객체화
- City.fromFirestore() : 파이어서버 데이타 객체화
- City.toFiresotre(): 객체에서 파이어서버 데이타로
factory City.fromFirestore(
DocumentSnapshot<Map<String, dynamic>> snapshot,
SnapshotOptions? options,
) {
final data = snapshot.data();
return City(
name: data?['name'],
state: data?['state'],
country: data?['country'],
capital: data?['capital'],
population: data?['population'],
regions:
data?['regions'] is Iterable ? List.from(data?['regions']) : null,
);
}
Map<String, dynamic> toFirestore() {
return {
if (name != null) "name": name,
if (state != null) "state": state,
if (country != null) "country": country,
if (capital != null) "capital": capital,
if (population != null) "population": population,
if (regions != null) "regions": regions,
};
}
}'firebase' 카테고리의 다른 글
| cloud function -1- 클라우드 펑션 활용 셋팅 절차입니다. 두가지가 있는데요. (0) | 2025.06.23 |
|---|---|
| firebase CRUD with flutter 파이어베스에 접근해서 추가,읽고,업데이트,삭제하는 방법입니다. (0) | 2025.06.21 |
| keytool'해시키' 도구에 대해, 자바를 설치하면 포함되어 활용이 가능하다. (0) | 2025.06.20 |
| 파이어베이스 구글 로그인 연동 with flutter (0) | 2025.06.20 |
| 카카오연동 + flutter + firebase (0) | 2025.06.19 |