스트림빌더로
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (!snapshot.hasData) {
return Center(child: CircularProgressIndicator());
}
if (snapshot.connectionState == ConnectionState.waiting) {
return Center(child: CircularProgressIndicator());
}
if (snapshot.hasError) {
return Text('Something went wrong');
}
요롷게 작성한 담에
String name = document['name'] ?? null;
를 넣었음.
근데 저 화면에 바로 들어가면
CircularProgressIndicator가 잠깐 떴다가
Bad state: cannot get a field on a DocumentSnapshotPlatform which does not exist
에러가 뜨고
들어가기 전에 2초정도 기다렸다가 들어가거나 저 에러 화면 뜨고 뒤로가기 후 다시 들어가면
문제없이 뜸
퓨쳐빌더로 하면 되겠지만 잦은 갱신용 스크린이라 스트림 빌더를 쓰고 싶은데
스트림 빌더 안에서 future도 안되고 async도 안되던데
어지간한 에러는 검색하면 해결방법이 나오던데
이건 뭐 플러터를 업데이트 해보라거나 퓨쳐빌더를 써라 이런 소리 밖에 없더라고
이미 플러터닥터 해보고 최신 버전 업뎃 해봄
간단한 데이터라 괜히 복잡해지는거 싫어서 컨트롤러 따로 안만들었었는데 그냥 state 따로 관리하는 컨트롤러 만들어서 해결했다.