강의

멘토링

커뮤니티

Inflearn Community Q&A

sjho04283070's profile image
sjho04283070

asked

[Code Factory] [Intermediate] Flutter Real Practice! State Management, Cache Management, Code Generation, GoRouter, Authentication Logic, etc. Essential Skills to Become an Intermediate!

Testing the authentication URL in Postman (token)

Dio로 api 요청 듣고 있는데 에러가 발생합니다 ㅜㅜ

Resolved

Written on

·

1.1K

0

E/flutter ( 4589): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: DioError [DioErrorType.connectTimeout]: Connecting timed out [0ms]

ElevatedButton(
                  onPressed: () async {
                    final rawString = 'test@codefactory.ai:testtest';

                    Codec<String, String> stringToBase64 = utf8.fuse(base64);

                    String token = stringToBase64.encode(rawString);

                    final resp = await dio.post(
                      'http://$ip/auth/login',
                      options: Options(
                        headers: {'authorization': 'Basic $token'},
                      ),
                    );

                    print(resp.data);
                  },
                  style: ElevatedButton.styleFrom(
                    backgroundColor: PRIMARY_COLOR,
                  ),
                  child: Text(
                    '로그인',
                  ),
                ),

코드를 잘못 작성한건가요?ㅜㅜ

flutter하이브리드-앱Flutter하이브리드 앱

Answer 1

0

codefactory님의 프로필 이미지
codefactory
Instructor

안녕하세요!

서버를 실행한 상태에서 요청을 넣으신게 맞으실까요?

연결을 시도하는 도중에 타임아웃이 난것으로 보입니다.

혹시 아직도 안되신다면 저희 카카오 커뮤니티에 들어오셔서 질문 스크린샷과 함께

저한테 개인톡으로 원격 신청해주세요.

감사합니다!

sjho04283070's profile image
sjho04283070

asked

Ask a question