본문 바로가기
반응형

플러터48

플러터에서 api 함수를 http로 요청하기 [flutter][OpenAPI] 플러터에서 api 함수를 http로 요청하기[flutter][OpenAPI] 서버와 통신이 필요한 앱을 개발하기 위해서는 http통신이 필수적이다.플러터에서 http통신을 통해 api 요청을 보내기 위해서는 아래 방법을 따르면 된다. 먼저 http 라이브러리를 연결한다. 라이브러리 버전은 각 상황에 맞게 사용하자.pubspec.yaml의 dependencies영역에 아래와 같이 추가한다.dependencies: http: ^0.13.5 그리고 api 요청을 보내는 코드 부분에서 아래와 같이 http 통신을 요청하면 된다.> 예시 코드final uri = Uri.parse("https://api.odcloud.kr/serviceList");var response = await http.get(uri); .. 2023. 2. 8.
SocketException: Connection failed (OS Error: Operation not permitted, errno = 1) [flutter][macOS] SocketException: Connection failed (OS Error: Operation not permitted, errno = 1)[flutter][macOS] 에러 내용애플 macOS에서 http통신 코드를 호출할 때, SocketException: Connection failed 에러가 나타날 때가 있다.에러 사유를 디버깅해보면 OS Error: Operation not permitted 라고 표시된다.이제 우리는 OS 에서의 권한적인 문제가 있나보구나 정도로 원인을 유추할 수 있다.  해결책아래와 같이 앱 프로젝트 내에서 권한을 추가한다.파일은 Runner/DebugProfile.entitlements 이다. 기존 코드는 server에 대해서만 true처리되어있을 수도 있는데 clie.. 2023. 2. 7.
[ios] Unhandled Exception: [core/not-initialized] Firebase has not been correctly initialized [ios] Unhandled Exception: [core/not-initialized] Firebase has not been correctly initialized 문제 상황 빌드할 때 에러 메시지와 함께 실패한다. Unhandled Exception: [core/not-initialized] Firebase has not been correctly initialized 해결 방법 1. 구글 파이어베이스 콘솔에서 GoogleServices-Info.plist를 생성하여 플러터 프로젝트에 포함시킨다. 해당 파일은 Info.plist와 같은 디렉터리에 복사해주면 된다. 2. main()함수에서 await Firebase.initializeApp(); 을 호출한다. 아래 참고! Future main() a.. 2023. 1. 14.
[Solved] Flutter Member not found: FirebaseAppPlatform.verifyExtends [Solved] Flutter Member not found: FirebaseAppPlatform.verifyExtends 해결 방법 (Solution) 1. pubspec.yaml에 아래 한 줄 추가 [Eng](Add below line to pubspec.yaml) dependency_overrides: firebase_core_platform_interface: 4.5.1 2. 아래 명령으로, 패키지 메이저 버전 업그레이드 [Eng](Use the command below to upgrade the package major version.) flutter pub upgrade --major-versions 3. iOS 프로젝트의 Pods를 업데이트 [Eng](Update the Pods of you.. 2023. 1. 14.
반응형