[Bloc 응용] 실전 앱 만들기 (책 리뷰 앱) : SNS 로그인, Firebase 적용, Bloc 상태 관리, GoRouter
개남님 좋은 강의 감사합니다. 현재 초기 페이지 연결하기까지 진행했습니다. 조금 오류가 있는 것 같은데 순수하게 궁금해서 여쭙니다! main.dart에서 AppDataLoadCubit을 lazy:false로 뒀잖아요? 그럼 앱을 처음 다운 받았을 때 init page가 보여지고 lazy가 false이기 때문에 스플래시 화면에 도달하기 전 이미 데이터를 로드해서, 시작하기 버튼을 눌러 스플래시 화면에 도달했을 때면, 바로 로그인 체크 중 입니다..가 보여야 하는 것 아닌가요?? 제 에뮬레이터에는 데이터 로드 중 입니다..가 보이길래 영상을 다시 돌려봤는데 개남님도 같은 현상이십니다. 그리고 시작하기 버튼을 통해 init -> splash에 도달했을 때 새로고침하지 않으면 데이터 로드 중 입니다..에서 로그인 확인 중 입니다..로 바뀌지 않습니다. 단순 오류인가 해서 앱을 지워 hydrated bloc을 초기화하고 다시 확인해 보았지만 같은 현상이 일어납니다.
강의에서는 아래와 같이 select 쿼리를 이용해 업데이트 된 회원을 조회후 response로 전달해 주었는데 @PutMapping("/api/v2/members/{id}") public UpdateMemberResponse updateMemberV2(@PathVariable("id") Long id, @RequestBody @Valid UpdateMemberRequest request) { memberService.update(id,request.getName()); Member findMember = memberService.findOne(id); return new UpdateMemberResponse(findMember.getId(), findMember.getName()); } 아래와 같이 하지 않은 이유가 있을까요?? @PutMapping("/api/v2/members/{id}") public UpdateMemberResponse updateMemberV2(@PathVariable("id") Long id, @RequestBody @Valid UpdateMemberRequest request) { memberService.update(id, request.getName()); return new UpdateMemberResponse(id, request.getName()); }
[코드팩토리] [초급] Flutter 3.0 앱 개발 - 10개의 프로젝트로 오늘 초보 탈출!
제대로 한것 같은데 에러가 뜨네요 ㅠㅠ 에러 점검 부탁드립니다~~ lib/database/drift_database.dart:34:7: Error: The non-abstract class 'LocalDatabase' is missing implementations for these members: - GeneratedDatabase.schemaVersion - QueryExecutorUser.schemaVersion Try to either - provide an implementation, - inherit an implementation from a superclass or mixin, - mark the class as abstract, or - provide a 'noSuchMethod' implementation. class LocalDatabase extends _$LocalDatabase{ ^^^^^^^^^^^^^ ../../AppData/Local/Pub/Cache/hosted/pub.dev/drift-2.10.0/lib/src/runtime/api/db_base.dart:27:11: Context: 'GeneratedDatabase.schemaVersion' is defined here. int get schemaVersion; ^^^^^^^^^^^^^ ../../AppData/Local/Pub/Cache/hosted/pub.dev/drift-2.10.0/lib/src/runtime/executor/executor.dart:66:11: Context: 'QueryExecutorUser.schemaVersion' is defined here. int get schemaVersion; ^^^^^^^^^^^^^ Target kernel_snapshot failed: Exception FAILURE: Build failed with an exception. * Where: Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1201 * What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'. > Process 'command 'C:\flutter\bin\flutter.bat'' finished with non-zero exit value 1 * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 7s Exception: Gradle task assembleDebug failed with exit code 1
[코드팩토리] [초급] Flutter 3.0 앱 개발 - 10개의 프로젝트로 오늘 초보 탈출!
안드로이드 폰에서 BouncingSrollPhysics를 적용해서 iOS같은 효과를 내고 싶습니다. 그런데 bouncing을 적용해도 자식 위젯들이 화면을 넘어가지 않으면 바운싱 되지않으며 스크롤도 되지 않습니다. 자식 위젯이 1개일 때, 안드로이드에서도 iOS같은 효과를 어떻게 낼 수 있나요??
[코드팩토리] [중급] Flutter 진짜 실전! 상태관리, 캐시관리, Code Generation, GoRouter, 인증로직 등 중수가 되기 위한 필수 스킬들!
섹션 9 상태관리 프로젝트에 적용하기 > 완성된 Pagination 로직 실행해보기 8분경에 요청이 중복으로 들어가는 부분을 고친다고 말씀하셨는데 저부분을 고치는 강의가 뒤에 있나요? 다른 프로젝트에 적용할때 같은 문제가 발생해서 언급을 하셨다면 어느부분인지 찾지를 못하겠네요.
[코드팩토리] [중급] Flutter 진짜 실전! 상태관리, 캐시관리, Code Generation, GoRouter, 인증로직 등 중수가 되기 위한 필수 스킬들!
안녕하세요 강사님 또 저입니다ㅠㅠ 중급강의의 로그인과 인증로직을 조금씩 변형해 현재 진행중인 프로젝트에 적용하려하는데 회원가입 POST가 필요한데 이를 예를들면 강의기준으로 UserMeStateNotifier내부에 Future<UserModelBase> login가 있듯이, Future<UserModel> postUser(UserModel userModel)로 Provider파트에 선언하고 @POST() Future<UserModel> postUser(@Body() UserModel user); 이런형태로 한 UserModel내에 선언해도될지 감이 안잡혀서 여쭤봅니다.이런부분에서 막힌거보니 아직 완전 이해를 못한거같습니다ㅠㅠ
클래스의 상속과 관련된 다형성은 부모객체로 인스턴스를 생성하여 부모클래스의 메소드와 자식클래스 메소드 2가지를 업/다운캐스팅하여 자유롭게 호출할 수 있지만, 단일상속이라는 한계 때문에 다른 부모클래스의 메소드는 호출할 수가 없잖아요? 그래서 인터페이스가 존재하는 이유구요. 마찬가지로, 인스턴스를 생성할 때 다형성을 활용하여 인터페이스 객체(부모 객체)로 생성할 수는 있지만, 이것은 ISP(Interface Segregation Principle)원칙에 따라 detect(), report() 2개의 메소드를 호출하려면 Detectable, Reportable 객체 2개를 생성해야 하기 때문에 메모리가 효율적으로 관리되지 못하는거구요. 따라서 구상클래스인 FactoryCam에서 인터페이스 변수를 직접 생성하고 setter함수로 필요한 인터페이스 변수를 주입한 다음(Dependency Injection) , 주입당한 객체는 인터페이스에 의존하기 때문에(Reportable, Detectable) 동시에 기능이 다른 2가지 메소드를 호출할 수 있는거구요.(Dependency Inversion Principle) ... 과정을 이해하였지만 말로 풀어내니까 굉장히 장황하군요 사실 이 부분은 인터페이스 문법이라기보다는 디자인 패턴과 관련이 있지 않나싶습니다.
방향 그래프 무방향 그래프에 따라서 자료구조에 자료를 저장하는 방법이 다르다고 하셨습니다. 그런데 지금 이 문제에서는 방향그래프 아닌가요?? 간선,엣지들을 보면 모두 방향이 있는 거 같은데, 왜 무방향그래프를 저장할 때처럼 arraylist에 값을 저장하는지 모르겠습니다.
Next.js로 Google Cloud Platform에 App Engine 서비스 배포를 진행하고 있습니다. 문제는 production ( 실 서비스 )와 development ( 개발용 )으로 나누어서 .env.development, .env.production의 두개의 환경변수를 가지고있습니다. 배포 시 실서비스 에서는 .env.production을 사용하도록 개발용 에서는 .env.development를 사용하도록 설정하려는데 이것저것 만져보아도 production만 사용하는 문제가 발생해버리네요. 현재 프로젝트구조와 설정코드는 이렇습니다. project ├── local └── Dockerfile └── docker-compose.yml ├── resource └── .next └── ... (Next.js 빌드 파일) └── node_modules └── package.json └── dev_app.yaml └── prd_app.yaml └── .env.development └── .env.production └── next.config.js └── ... (기타 Next.js 프로젝트 파일) 여기서 package.json의 script설정은 다음과 같습니다. { dev: "next dev", start: "next start", lint: "next lint", deploy: "npm run build && gcloud app deploy --project='production' -q --appyaml=prd_app.yaml", deploy:dev: "npm run build:dev && gcloud app deploy --project='development' -q --appyaml=dev_app.yaml", build: "dotenv -e .env.production next build", build:dev: "dotenv -e .env.development next build" } next.config.js는 특별히 건드리지 않았습니다. dev_app.yaml, prd_app.yaml파일은 서비스명만 각각 설정해 주었습니다. runtime: nodejs20 # or another supported version service: development 질문 1. 현재 app engine 업로드된 용량, 로직을 보니 빌드파일이 아닌 프로젝트 그대로 들어가는 것 같습니다. 빌드는 환경변수파일도 정상적으로 분기되는데 앱엔진에서 해당문제가 발생하는 것으로보아 혹시 Next.js에서 빌드된 파일로 app engine에 배포할 수 있는지 궁금합니다. 질문 2. 빌드파일만 올릴수 없다 라고 하더라도 프로젝트 그대로 올리면서 환경변수를 분기할 방법이 있는지 궁금합니다. 정말 문서건 블로그건 구글서칭, 깃허브검색, GPT 모두 끈질기게 시도해봤지만 능력부족 탓인지 성공하지 못했습니다.. 능력자분들께서 도움주시면 잊지않겠습니다!!
[코드팩토리] [중급] Flutter 진짜 실전! 상태관리, 캐시관리, Code Generation, GoRouter, 인증로직 등 중수가 되기 위한 필수 스킬들!
class ProductPage extends StatelessWidget { const ProductPage({super.key}); @override Widget build(BuildContext context) { return PaginationListView<ProductModel>( provider: productProvider, itemBuilder: <ProductModel>(_, index, ProductModel model) => GestureDetector( onTap: () => context.goNamed( RestaurantDetailPage.routeName, pathParameters: { 'rid': model.restaurant.id, }, ), child: ProductCard.fromProductModel( model: model, ), ), ); } } 여기서 이상한 에러가 뜹니다. 먼저 'rid': model.restaurant.id 이 부분에서는 아래와 같은 에러가 뜹니다. The property 'restaurant' can't be unconditionally accessed because the receiver can be 'null'. Try making the access conditional (using '?.') or adding a null check to the target ('!').dart unchecked_use_of_nullable_value 그리고 두 번째로, ProductCard.fromProductModel(model: model) 에서는 이런 에러가 뜹니다. The argument type 'ProductModel' can't be assigned to the parameter type 'ProductModel'.dart argument_type_not_assignable 두 에러 모두 이해되지 않습니다. ProductModel 타입을 ProductModel 타입으로 Assign할 수 없다니요? 같은 타입인데 이런 에러가 뜹니다. 또한 첫 번째 에러의 경우에도, 분명히 nullable 타입이 존재하지 않는데 nullable 체크를 하라고 하고 있습니다. 당황스럽습니다. 한편, 강의는 이런 식으로 되어 있습니다. itemBuilder: <ProductModel>(_, index, model) 즉 model 의 타입을 따로 지정해주지 않았습니다. 이렇게 했을경우 model의 타입은 dynamic 이 되며, 자동 완성 기능은 수행할 수 없지만, 결론적으로 잘 작동은 합니다. 그런데 왜 저런 이상한 에러가 발생하는 지 모르겠습니다. 여기 이와 관련된 코드를 덧붙입니다. 그러나 대부분 강의와 동일합니다. @JsonSerializable() class ProductModel implements IModelWithId { @override final String id; /// 상품 이름 final String name; /// 상품 상세 정보 final String detail; /// 상품 이미지 URL @JsonKey(fromJson: DataUtils.pathToUrl) final String imgUrl; /// 상품 가격 final int price; /// 레스토랑 정보 final RestaurantModel restaurant; ProductModel({ required this.id, required this.name, required this.detail, required this.imgUrl, required this.price, required this.restaurant, }); factory ProductModel.fromJson(Map<String, dynamic> json) => _$ProductModelFromJson(json); } typedef PaginationWidgetBuilder<T extends IModelWithId> = Widget Function( BuildContext context, int index, T model, ); 문제가 발생하고 있는 스크린샷:
[코드팩토리] [중급] Flutter 진짜 실전! 상태관리, 캐시관리, Code Generation, GoRouter, 인증로직 등 중수가 되기 위한 필수 스킬들!
Token 발급 과정에서 username:password 값을 base64 로 인코딩 후 authorization 헤더에 Basic $token 형태로 전송하는 것이 정석이라고 말씀해주셨습니다. 질문1. Basic $token 형태는 인증정보가 그대로 base64 형태로 인코딩해줍니다. 그러면 누군가가 이 패킷을 까보기만 하면 데이터를 알 수 있는 것이 아닌가요..? 이 부분이 이해가 잘 안되네요. 설명부탁드립니다.. 질문2. 추가로 챗gpt 에게 질문했을 때, 로그인할 때 content type 을 application/x-www-form-urlencoded 형태로 보내라고 하는데, 대부분은 json 형태로 전송하더라구요.. 설명부탁드립니다...