Dev/Flutter

[Flutter/web] Platform 함수 에러 관련

hau 2021. 1. 15. 15:57
728x90

Platform 관련 함수는 웹에서 사용이 불가능한 모양

 

 

사용하지 않거나,

그럼에도 불구하고 사용하고싶으면 try-catch 감싸라는 이야기 존재

 

 

//You can use a try-catch block to prevent the exception from breaking the flow:

bool kisweb;
try{
    if(Platform.isAndroid||Platform.isIOS) {
        kisweb=false;
    } else {
        kisweb=true;
    }
} catch(e){
    kisweb=true;
}



 

Reference

https://stackoverflow.com/questions/58459483/unsupported-operation-platform-operatingsystem

 

Unsupported operation: Platform._operatingSystem

My flutter code isn't running on web. I found that "bool kisweb" can be used to detect the platform. But my code is failing at "FirebaseAuth.instance". Does this mean I can't use Firebaseauth on ...

stackoverflow.com

 

728x90