ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • flutter firebase 로그인 준비
    카테고리 없음 2021. 12. 22. 12:06

    flutter firebase 세팅 준비전 먼저 해야될 것이 있다. 

    futureBuilder 를 써서 앱의 상태를 확인 해야 합니다. 

     

    final Future<FirebaseApp> _initializeApp = Firebase.initializeApp();

    먼저 함수 설정을 합니다. 

     

    @override
      Widget build(BuildContext context) {
        return FutureBuilder(
            future: _initializeApp,
            builder: (context, snapshot) {
              if (snapshot.hasError) {
                return Text('error');
              } else if (snapshot.connectionState == ConnectionState.done) {
                return HomePage();
              }
              return CircularProgressIndicator();
            });
      }
    }

     

    import 'package:flutter/material.dart';
    
    class HomePage extends StatelessWidget {
      const HomePage({Key? key}) : super(key: key);
    
      @override
      Widget build(BuildContext context) {
        return Container(
          color: Colors.yellow,
        );
      }
    }
    

     

Designed by Tistory.