[Flutter] firebase QueryDocumentSnapshot 클래스

개발 기록·2024년 1월 26일

Flutter

목록 보기
2/18

QueryDocumentSnapshot 클래스의 get 메서드를 사용해 firestore에 등록한 데이터를 가져올 수 있다.

기존작성 코드

List<Map<String, dynamic>> todos;
String content = todo['content']; // todo명
bool isDone = todo['isDone']; // todo 완료 여부

수정코드

final List<QueryDocumentSnapshot<Map<String, dynamic>>> todos;
final String content = todo.get('content');
final bool isDone = todo.get('isDone');

0개의 댓글