inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

묻고 답해요

173만명의 커뮤니티!! 함께 토론해봐요.

bottomInset 관련 질문 있습니다~

미해결

[코드팩토리] [초급] Flutter 3.0 앱 개발 - 10개의 프로젝트로 오늘 초보 탈출!

선생님~ 위 코드에서 궁금한 점이 있는데요, bottomInset 변수에 할당되는 MediaQuery. of (context).viewInsets.bottom 는 프레임워크단에서 값의 변화가 있을때마다 꾸준히 값을 injection 해주는 것인가요? print로 찍어보니 bottomsheet가 올라오는 동작 중에도 지속적으로 값이 찍히더라구요. HomeScreen위젯(stateFul)에서 어떻게 `final bottomInset`의 변화를 감지해서 다시 ScheduleBottomSheet(Stateless) 를 빌드 할 수 있는지도 궁금합니다. Calendar위젯처럼 HomeScreen위젯(stateFul)에서 ondaySelected함수를 인자로 넘겨받아서 setState가 실행되는 것도 아닌데, build가 되면서 bottom페딩이 실시간으로 적용되는게 이해가 가지 않습니다. 강의 잘 보고 있습니다. 도움주시면 감사드리겠습니다~

  • flutter
  • 클론코딩
gunwoong1129 댓글 1 좋아요 1 조회수 199

현재는 Stream 프로바이더 생성 되는것 같습니다! 강의 들으시는분들 참고해보셔요~

해결됨

[코드팩토리] [중급] Flutter 진짜 실전! 상태관리, 캐시관리, Code Generation, GoRouter, 인증로직 등 중수가 되기 위한 필수 스킬들!

@riverpod Stream<int> gStateStream(GStateStreamRef ref) async* { await Future.delayed(Duration(seconds: 2)); for (int i = 0; i < 10; i++) { await Future.delayed(Duration(seconds: 1)); yield i; } } 현재시각 기준으로 Stream 프로바이더도 생성 되는것같네요~

  • flutter
  • 하이브리드-앱
진표 댓글 1 좋아요 1 조회수 232

firebase collection 및 사진 등록 문제

해결됨

Flutter로 SNS 앱 만들기

강사님 강의 잘 듣고 있습니다. 근데 오류 난 거 없이 잘 따라가고 있는데 collection에서 users가 생성이 안되고, 사진이 안 나옵니다. 사진 안 나왔을 때 코드 긁어서 넣었는데도 안 나오는데, 혹시 firebase test기간 30일이 지나서 그런가요?..

  • flutter
  • android
  • firebase
  • dart
gimseongcheol33 댓글 3 좋아요 0 조회수 487

모든 Provider의 인스턴스가 앱이 실행되면 무조건 다 생기나요?

미해결

[코드팩토리] [중급] Flutter 진짜 실전! 상태관리, 캐시관리, Code Generation, GoRouter, 인증로직 등 중수가 되기 위한 필수 스킬들!

안녕하세요! provider적용하기 강의 듣고 있습니다. 궁금한게, 프로젝트를 진행할 수 록 여러개의 provider를 생성하게 되는데 그럼 이 모든 provider의 인스턴스가 사용하지 않아도 무조건 앱 실행시 다 인스턴스화 되어 메모리에 올라가게 되나요? 제가 객체지향관련 개념이 플러터하면서 처음이라 조금 헷갈립니다. 감사합니다.

  • flutter
  • 하이브리드-앱
kmgkxm 댓글 1 좋아요 0 조회수 238

(실습) ORM 적용 - HTTP Response 처리

미해결

실전! FastAPI 입문

from typing import List from fastapi import FastAPI, Body, HTTPException, Depends from pydantic import BaseModel from sqlalchemy.orm import Session from database.orm import ToDo from database.connection import get_db from database.repository import get_todos from schema.response import ListToDoResponse, ToDoSchema app = FastAPI() @app.get("/") def heath_check_handler(): return {"ping": "pong"} todo_data = { 1: { "id": 1, "contents": "실전! FastAPI 섹션 0 수강", "is_done": True, }, 2: { "id": 2, "contents": "실전! FastAPI 섹션 1 수강", "is_done": False, }, 3: { "id": 3, "contents": "실전! FastAPI 섹션 2 수강", "is_done": False, }, } @app.get("/todos", status_code=200) def get_todos_handler( order: str | None = None, session: Session = Depends(get_db), ) -> ListToDoResponse: todos: List[ToDo] = get_todos(session=session) if order and order == "DESC": return ListToDoResponse( todos=[ToDoSchema.from_orm(todo) for todo in todos[::-1]] ) return ListToDoResponse( todos=[ToDoSchema.from_orm(todo) for todo in todos] ) @app.get("/todos/{todo_id}", status_code=200) def get_todo_handler(todo_id: int): todo = todo_data.get(todo_id) if todo: return todo raise HTTPException(status_code=404, detail="ToDo Not Found") class CreateToDoRequest(BaseModel): id: int contents: str is_done: bool @app.post("/todos", status_code=201) def create_todo_handler(request: CreateToDoRequest): todo_data[request.id] = request.dict() return todo_data[request.id] @app.patch("/todos/{todo_id}", status_code=200) def update_todo_handler( todo_id: int, is_done: bool = Body(..., embed=True) ): todo = todo_data.get(todo_id) if todo: todo["is_done"] = is_done return todo raise HTTPException(status_code=404, detail="ToDo Not Found") @app.delete("/todos/{todo_id}") def delete_todo_handler(todo_id: int): todo = todo_data.pop(todo_id, None) if todo: return raise HTTPException(status_code=404, detail="ToDo Not Found") from typing import List from pydantic import BaseModel class ToDoSchema(BaseModel): id: int contents: str is_done: bool class Config: orm_mode = True class ListToDoResponse(BaseModel): todos: List[ToDoSchema] from typing import List from sqlalchemy import select from sqlalchemy.orm import Session from database.orm import ToDo def get_todos(session: Session) -> List[ToDo]: return list(session.scalars(select(ToDo))) from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker DATABASE_URL = "mysql+pymysql://root:todos@127.0.0.1:3306/todos" engine = create_engine(DATABASE_URL, echo=True) SessionFactory = sessionmaker(autocommit=False, autoflush=False, bind=engine) def get_db(): session = SessionFactory() try: yield session finally: session.close() from sqlalchemy import Boolean, Column, Integer, String from sqlalchemy.orm import declarative_base Base = declarative_base() class ToDo(Base): __tablename__ = 'todo' id = Column(Integer, primary_key=True, index=True) contents = Column(String(256), nullable=False) is_done = Column(Boolean, nullable=False) def __repr__(self): return f"ToDo(id={self.id}, contents={self.contents}, is_done={self.is_done})" 에러가 납니다. 파이썬 콘솔 <input>:1: PydanticDeprecatedSince20: The from_orm method is deprecated; from schema.response import ToDoSchema from datagbase.orm import ToDo Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm 2023.3.2\plugins\python\helpers\pydev\pydevconsole.py", line 364, in runcode coro = func() ^^^^^^ File "<input>", line 1, in <module> File "C:\Program Files\JetBrains\PyCharm 2023.3.2\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import module = self._system_import(name, args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ModuleNotFoundError: No module named 'datagbase' from database.orm import ToDo todo = ToDo(id=100, contents="test", is_done=True) ToDoSchema.from_orm(todo) <input>:1: PydanticDeprecatedSince20: The from_orm method is deprecated; set model_config['from_attributes']=True and use model_validate instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/ Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm 2023.3.2\plugins\python\helpers\pydev\pydevconsole.py", line 364, in runcode coro = func() ^^^^^^ File "<input>", line 1, in <module> File "C:\Users\manag\pyProject\todos\Lib\site-packages\typing_extensions.py", line 2499, in wrapper return arg(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^ File "C:\Users\manag\pyProject\todos\Lib\site-packages\pydantic\main.py", line 1126, in from_orm raise PydanticUserError( pydantic.errors.PydanticUserError: You must set the config attribute from_attributes=True to use from_orm http://localhost:8000/docs#/default/get_todos_handler_todos_get 접속시 터미널 INFO: 127.0.0.1:56312 - "GET /docs HTTP/1.1" 200 OK INFO: 127.0.0.1:56312 - "GET /openapi.json HTTP/1.1" 200 OK 2024-01-23 16:06:15,108 INFO sqlalchemy.engine.Engine BEGIN (implicit) 2024-01-23 16:06:15,109 INFO sqlalchemy.engine.Engine SELECT todo.id, todo.contents, todo.is_done FROM todo 2024-01-23 16:06:15,109 INFO sqlalchemy.engine.Engine [cached since 826.5s ago] {} 2024-01-23 16:06:15,113 INFO sqlalchemy.engine.Engine ROLLBACK INFO: 127.0.0.1:56312 - "GET /todos HTTP/1.1" 500 Internal Server Error ERROR: Exception in ASGI application Traceback (most recent call last): File "C:\Users\manag\pyProject\todos\Lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 404, in run_asgi result = await app( # type: ignore[func-returns-value] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\manag\pyProject\todos\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\manag\pyProject\todos\Lib\site-packages\fastapi\applications.py", line 1054, in call await super().__call__(scope, receive, send) File "C:\Users\manag\pyProject\todos\Lib\site-packages\starlette\applications.py", line 123, in call await self.middleware_stack(scope, receive, send) File "C:\Users\manag\pyProject\todos\Lib\site-packages\starlette\middleware\errors.py", line 186, in call raise exc File "C:\Users\manag\pyProject\todos\Lib\site-packages\starlette\middleware\errors.py", line 164, in call await self.app(scope, receive, _send) File "C:\Users\manag\pyProject\todos\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "C:\Users\manag\pyProject\todos\Lib\site-packages\starlette\_exception_handler.py", line 64, in wrapped_app raise exc File "C:\Users\manag\pyProject\todos\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "C:\Users\manag\pyProject\todos\Lib\site-packages\starlette\routing.py", line 762, in call await self.middleware_stack(scope, receive, send) File "C:\Users\manag\pyProject\todos\Lib\site-packages\starlette\routing.py", line 782, in app await route.handle(scope, receive, send) File "C:\Users\manag\pyProject\todos\Lib\site-packages\starlette\routing.py", line 297, in handle await self.app(scope, receive, send) File "C:\Users\manag\pyProject\todos\Lib\site-packages\starlette\routing.py", line 77, in app await wrap_app_handling_exceptions(app, request)(scope, receive, send) File "C:\Users\manag\pyProject\todos\Lib\site-packages\starlette\_exception_handler.py", line 64, in wrapped_app raise exc File "C:\Users\manag\pyProject\todos\Lib\site-packages\starlette\_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "C:\Users\manag\pyProject\todos\Lib\site-packages\starlette\routing.py", line 72, in app response = await func(request) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\manag\pyProject\todos\Lib\site-packages\fastapi\routing.py", line 299, in app raise e File "C:\Users\manag\pyProject\todos\Lib\site-packages\fastapi\routing.py", line 294, in app raw_response = await run_endpoint_function( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\manag\pyProject\todos\Lib\site-packages\fastapi\routing.py", line 193, in run_endpoint_function return await run_in_threadpool(dependant.call, **values) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\manag\pyProject\todos\Lib\site-packages\starlette\concurrency.py", line 40, in run_in_threadpool return await anyio.to_thread.run_sync(func, *args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\manag\pyProject\todos\Lib\site-packages\anyio\to_thread.py", line 56, in run_sync return await get_async_backend().run_sync_in_worker_thread( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\manag\pyProject\todos\Lib\site-packages\anyio\_backends\_asyncio.py", line 2134, in run_sync_in_worker_thread return await future ^^^^^^^^^^^^ File "C:\Users\manag\pyProject\todos\Lib\site-packages\anyio\_backends\_asyncio.py", line 851, in run result = context.run(func, *args) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\manag\pyProject\todos\src\main.py", line 48, in get_todos_handler todos=[ToDoSchema.from_orm(todo) for todo in todos] ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\manag\pyProject\todos\Lib\site-packages\typing_extensions.py", line 2499, in wrapper return arg(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^ File "C:\Users\manag\pyProject\todos\Lib\site-packages\pydantic\main.py", line 1126, in from_orm raise PydanticUserError( pydantic.errors.PydanticUserError: You must set the config attribute from_attributes=True to use from_orm

  • python
  • 리팩토링
  • orm
  • FastAPI
  • pytest
네오스카이 댓글 2 좋아요 0 조회수 1267

5~6강 질문이요

미해결

자바와 스프링 부트로 생애 최초 서버 만들기, 누구나 쉽게 개발부터 배포까지! [서버 개발 올인원 패키지]

post방식은 dto 객체 앞에 @RequestBody가 있는데 get방식은 왜 dto객체 앞에 @RequestParam을 안 써요? 맨 처음에 dto 객체 없었을 때 매개변수 이용하였을 때는 @RequestParam 썼던 것 같은데..

  • java
  • spring
  • aws
  • mysql
  • spring-boot
  • jpa
ghdtldus03a 댓글 2 좋아요 1 조회수 404

추가되었으면 하는 사항과 조언 요청

해결됨

Flutter 앱 개발 실전

안녕하세요. riverpod 기반으로 BaseView, BaseViewModel, BaseViewState 를 구현해주셔서 이를 활용하여 로그인 예제 샘플코드에 적용하여 잘 동작되는 걸 확인했습니다. 다시 한번 감사드립니다. 섹터2 상태관리 동영상이 도움 되지만 기회가 되신다면 Riverpod 구현 코드 변경 부분 관련으로 동영상 강의 추가해주시면 수강자 및 수강신청 예정자에게 큰 도움이 될 거 같습니다. 좀 더 추가되면 좋을 사항도 적어봅니다. 로그인 예제, Retrofit 활용한 JSON 데이터 처리 과정, LogInterceptor 활용한 JWT 인증처리 또는 Session 처리 BaseView 구현하는 역량을 향상시키기 위해서 어떤 과정을 수강(학습)하면 도움이 될지 조언해주시면 큰 도움이 될 거 같습니다. 언어 상관없이 어떤 과정을 배우면 도움될런지요?

  • flutter
Link 댓글 1 좋아요 1 조회수 295

video player에서 플레이가 안되는 이슈

미해결

[코드팩토리] [초급] Flutter 3.0 앱 개발 - 10개의 프로젝트로 오늘 초보 탈출!

video player에서 플레이 버튼을 누르면 플레이가 안되네요. play - pause 를 반복적으로 누르면 재생이 됩니다만, 또 소리는 안납니다.

  • flutter
  • 클론코딩
junyoung.yoon 댓글 1 좋아요 0 조회수 262

~/jpashop.mv.db 파일을 못찾겠습니다.

미해결

실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발

[질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (예) 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/) 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예) [질문 내용] 이 과정에서 jdbc:h2:~/jpashop까지 입력을 완료하고 데이터베이스가 잘 생성이 되었는데 ~ /jpashop.m v.db이 어디에 생성된건지 모르겠습니다. ~ /jpashop.m v.db

  • java
  • spring
  • 웹앱
  • spring-boot
  • jpa
taetae 댓글 2 좋아요 0 조회수 1006

자동 오버라이드시 super 코드가 없습니다.

미해결

[코드팩토리] [초급] Flutter 3.0 앱 개발 - 10개의 프로젝트로 오늘 초보 탈출!

자동 오버라이드시 하기처럼 super.initState() 코드가 없습니다. initState 말고도 자동 오버라이드(ctrl + o)시 종종 그런 코드들이 있는데요. 안써도 괜찮은것인가요?

  • flutter
  • 클론코딩
junyoung.yoon 댓글 1 좋아요 0 조회수 238

애플 로그인 위해 애플 개발자 인증센터는 Developer 프로그램 가입해야 하나요?

해결됨

[Bloc 응용] 실전 앱 만들기 (책 리뷰 앱) : SNS 로그인, Firebase 적용, Bloc 상태 관리, GoRouter

안녕하세요? 현재까지는 잘 따라오고 있다가 애플 인증센터에서 막혔는데요. 강사님과 같은 화면이 나오지 않고 약간 간소화된 화면이 나오는데요. Apple Developer Program 가입 안해서 이런 화면이 나오는거 같은데, 반드시 가입해야 하나요? 가입을 하려면 129,000 원 내라고 하던데, 임시로 테스트로 할 수 있는 방안은 없는지요?

  • flutter
  • firebase
  • bloc
011414 댓글 1 좋아요 0 조회수 405

타입 관련 질문있습니다

미해결

[코드팩토리] [초급] Flutter 3.0 앱 개발 - 10개의 프로젝트로 오늘 초보 탈출!

final resp = await [ Permission.camera , Permission.microphone].request(); 여기서 [ ] 대괄호 안에 permission.camera 와 permission.microphone을 넣어주고 있는데 [ ] 대괄호 안에 넣는 타입은 리스트 타입으로 한번에 넘겨줄려고 저렇게 괄호 안에 쓰는건지 궁금합니다. 어떤 이유로 대괄호를 사용하는지가 궁금합니다.

  • flutter
  • 클론코딩
winwin7200 댓글 1 좋아요 0 조회수 156

특정강의 사운드가 한쪽만 들립니다.

해결됨

[2025 리뉴얼]플러터플로우로 코딩 없이 한달 안에 앱 만들기

다 그런건 아닌것 같구 가장 기본이자 가장 많이 활용하는 Column, Row 강의에서 사운드가 한쪽만 들리는데 저만 그런가 해서요. 스피커가 아니라 헤드셋을 써서 강의들 듣다보니 한쪽만 들려요..ㅎㅎ

  • flutter
  • firebase
  • no-code
  • flutterflow
tera.d 댓글 2 좋아요 1 조회수 261

Provider 사용법 질문

해결됨

Flutter로 SNS 앱 만들기

저는 원래 Provider를 ChangeNotifier와 함께 사용하여 notifyListener()를 통해 필요할 때 빌드호출을 진행하였습니다 이 강의에서는 각 State를 extends하고 LocatorMixin 후 read/watch를 통해 상태를 관리하는 것 같습니다 보통 state를 따로 만들어 stateNotifier로 관리하는 게 더욱 표준적인 방법일까요?

  • flutter
  • android
  • firebase
  • dart
lys8691 댓글 1 좋아요 0 조회수 289

GoogleService-Info.plist > REVERSED_CLIENT_ID 안보입니다.

해결됨

[Bloc 응용] 실전 앱 만들기 (책 리뷰 앱) : SNS 로그인, Firebase 적용, Bloc 상태 관리, GoRouter

아무리 찾아봐도 안보이는데 뭐가 잘못된 것일까요? <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>API_KEY</key> <string>AIzaSyDrx2zMhB0rjE20rHntX6p1qG2Ya5y39JA</string> <key>GCM_SENDER_ID</key> <string>914949717898</string> <key>PLIST_VERSION</key> <string>1</string> <key>BUNDLE_ID</key> <string>com.archy712.bookreviewhome01.bookreviewHome01</string> <key>PROJECT_ID</key> <string>bookreview-home-01</string> <key>STORAGE_BUCKET</key> <string>bookreview-home-01.appspot.com</string> <key>IS_ADS_ENABLED</key> <false></false> <key>IS_ANALYTICS_ENABLED</key> <false></false> <key>IS_APPINVITE_ENABLED</key> <true></true> <key>IS_GCM_ENABLED</key> <true></true> <key>IS_SIGNIN_ENABLED</key> <true></true> <key>GOOGLE_APP_ID</key> <string>1:914949717898:ios:66b1d2b693a784b6029273</string> </dict> </plist>

  • flutter
  • firebase
  • bloc
011414 댓글 2 좋아요 0 조회수 1662

값타입과 @MappedSuperclass의 차이

미해결

자바 ORM 표준 JPA 프로그래밍 - 기본편

학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요. 1. 강의 내용과 관련된 질문을 남겨주세요. 2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요. (자주 하는 질문 링크: https://bit.ly/3fX6ygx) 3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요. (질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG) 질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요. ========================================= [질문 템플릿] 1. 강의 내용과 관련된 질문인가요? 예 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? 예 3. 질문 잘하기 메뉴얼을 읽어보셨나요? 예 [질문 내용] 값타입 @MappedSuperclass의 차이가 무엇인가요? BaseEntity를 @MappedSuperclass로 놓고 상속받아서 여러 속성을 한꺼번에 갖는것과 값타입 클래스를 @Embeddable로 설정해서 위임하는 것의 차이가 궁금합니다. 둘다 여러 속성들을 동시에 관리해서 다른 테이블의 속성으로 사용하기 위한 목적이라면 하나만 있으면 될 것 같은데, 왜 굳이 2개 모두 필요한가요?

  • java
  • jpa
김희수 댓글 2 좋아요 0 조회수 645

GenerationType.IDENTITY Null값 허용 안 되는 에러

미해결

자바 ORM 표준 JPA 프로그래밍 - 기본편

안녕하세요. 기본 키 맵핑에서 GenerationType.IDENTITY 관련 부분 질문드립니다. GenerationType.IDENTITY는 PK를 입력하지 않아도 auto increment라고 해서 저절로 생성되는 거 아닌가요? 그런데 이런 에러가 떴습니다. ERROR: NULL not allowed for column "ID"; SQL statement: 답변 부탁드리겠습니다. 감사합니다! package hellojpa; import javax.persistence.*; @Entity public class Member { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(name = "name") private String username; public Member() { // 기본 생성자가 하나 있어야 함 } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } } package hellojpa; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.EntityTransaction; import javax.persistence.Persistence; import javax.transaction.Transaction; public class JpaMain { public static void main(String[] args) { EntityManagerFactory emf = Persistence.createEntityManagerFactory("hello"); // EntityManagerFactory는 application 로딩 시점에 딱 하나만 만들어놔야 한다. // Transaction 단위로 EntityManager를 만든다. EntityManager em = emf.createEntityManager(); // 쉽게 생각하면 데이터베이스 connection을 하나 받았다고 생각할 수 있음. EntityTransaction tx = em.getTransaction(); tx.begin(); try{ Member member = new Member(); member.setUsername("Opeahchsdf"); em.persist(member); tx.commit(); } catch (Exception e) { tx.rollback(); } finally { em.close(); // 끝나면 반드시 닫아줘야 함 } emf.close(); } } <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.2" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd"> <persistence-unit name="hello"> <properties> <!-- 필수 속성 --> <property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/> <property name="javax.persistence.jdbc.user" value="sa"/> <property name="javax.persistence.jdbc.password" value=""/> <property name="javax.persistence.jdbc.url" value="jdbc:h2:tcp://localhost/~/test"/> <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/> <!-- 옵션 --> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.format_sql" value="true"/> <property name="hibernate.use_sql_comments" value="true"/> <property name="hibernate.hbm2ddl.auto" value="create" /> </properties> </persistence-unit> </persistence>

  • java
  • jpa
이주현 댓글 3 좋아요 0 조회수 1219

RatingPagination 렌더링 부분에서 api 요청이 가지 않고 있습니다.

미해결

[코드팩토리] [중급] Flutter 진짜 실전! 상태관리, 캐시관리, Code Generation, GoRouter, 인증로직 등 중수가 되기 위한 필수 스킬들!

- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. 코드팩토리 디스코드 https://bit.ly/3HzRzUM Flutter 강의를 구매하시면 코드팩토리 디스코드 서버 플러터 프리미엄 채널에 들어오실 수 있습니다! 디스코드 서버에 들어오시고 저에게 메세지로 강의를 구매하신 이메일을 보내주시면 프리미엄 채널에 등록해드려요! 프리미엄 채널에 들어오시면 모든 질의응답 최우선으로 답변해드립니다! RatingPagination 렌더링 강의에서 http://ip/restaurant/:rid/rating 으로 요청이 가지 않고 있습니다! 어떤 부분을 놓치고 있을까요? restaurant_detail_screen.dart class RestaurantDetailScreen extends ConsumerStatefulWidget { final String id; const RestaurantDetailScreen({required this.id, super.key}); @override ConsumerState<RestaurantDetailScreen> createState() => _RestaurantDetailScreenState(); } class _RestaurantDetailScreenState extends ConsumerState<RestaurantDetailScreen> { @override void initState() { super.initState(); ref.read(restaurantProvider.notifier).getDetail(id: widget.id); } @override Widget build(BuildContext context) { final state = ref.watch(restaurantDetailProvider(widget.id)); final ratingsState = ref.watch(restaurantRatingProvider(widget.id)); if (state == null) { return DefaultLayout( child: Center( child: CircularProgressIndicator(), ), ); } return DefaultLayout( title: '불타는 떡볶이', child: CustomScrollView( slivers: [ renderTop( model: state!, ), if (state is! RestaurantDetailModel) renderLoading(), if (state is RestaurantDetailModel) renderLabel(), if (state is RestaurantDetailModel) renderProduct( products: state.products, ), if(ratingsState is CursorPagination<RatingModel>) renderRatings(models: ratingsState.data), ], ), ); } SliverPadding renderRatings({ required List<RatingModel> models, }){ return SliverPadding( padding: EdgeInsets.symmetric(horizontal: 16.0), sliver: SliverList( delegate: SliverChildBuilderDelegate( (_, index) => RatingCard.fromModel( model: models[index], ), childCount: models.length, ), ) ); } //skeleton 사용 -> 로딩중에는 미리보는것 같은 효과 가져오기 SliverPadding renderLoading() { return SliverPadding( padding: EdgeInsets.symmetric( vertical: 16.0, horizontal: 16.0, ), sliver: SliverList( delegate: SliverChildListDelegate( List.generate( 3, (index) => Padding( padding: const EdgeInsets.only(bottom: 32.0), child: SkeletonParagraph( style: SkeletonParagraphStyle( lines: 5, padding: EdgeInsets.zero, ), ), ), ), ), ), ); } // 일반 위젯을 slivers에 추가하려면 SliverToBoxAdapter로 감싸줘야 한다. SliverToBoxAdapter renderTop({ required RestaurantModel model, }) { return SliverToBoxAdapter( child: RestaurantCard.fromModel( model: model, isDetail: true, ), ); } SliverPadding renderLabel() { return SliverPadding( padding: EdgeInsets.symmetric(horizontal: 16.0), sliver: SliverToBoxAdapter( child: Text( '메뉴', style: TextStyle( fontSize: 18.0, fontWeight: FontWeight.w500, ), ), ), ); } SliverPadding renderProduct({ required List<RestaurantProductModel> products, }) { return SliverPadding( padding: EdgeInsets.symmetric(horizontal: 16.0), sliver: SliverList( delegate: SliverChildBuilderDelegate( (context, index) { final model = products[index]; return Padding( padding: const EdgeInsets.only(top: 16.0), child: ProductCard.fromModel( model: model, ), ); }, childCount: products.length, ), ), ); } } restaurantRatingProvider final restaurantRatingProvider = StateNotifierProvider.family<RestaurantRatingStateNotifier, CursorPaginationBase, String>((ref, id){ final repository = ref.watch(restaurantRatingRepositoryProvider(id)); return RestaurantRatingStateNotifier(repository: repository); }); class RestaurantRatingStateNotifier extends StateNotifier<CursorPaginationBase> { final RestaurantRatingRepository repository; RestaurantRatingStateNotifier({ required this.repository, }) : super( CursorPaginationLoading(), ); } restaurantRatingRepositoryProvider final restaurantRatingRepositoryProvider = Provider.family<RestaurantRatingRepository, String>((ref, id) { final dio = ref.watch(dioProvider); return RestaurantRatingRepository(dio, baseUrl: 'http://$ip/restaurant/$id/rating'); }); // http://ip/restaurant/:rid/rating @RestApi() abstract class RestaurantRatingRepository implements IBasePaginationRepository<RatingModel>{ factory RestaurantRatingRepository(Dio dio, {String baseUrl}) = _RestaurantRatingRepository; @GET('/') @Headers({ 'accessToken': 'true', }) Future<CursorPagination<RatingModel>> paginate({ @Queries() PaginationParams? paginationParams = const PaginationParams(), //@Queries() -> PaginationParams 클래스의 값들이 자동으로 쿼리로 변환되어서 요청할 때 들어감! }); }

  • flutter
  • 하이브리드-앱
star 댓글 2 좋아요 0 조회수 382

리포맷팅이 안되는 코드

미해결

[코드팩토리] [초급] Flutter 3.0 앱 개발 - 10개의 프로젝트로 오늘 초보 탈출!

상기 코드 저 라인은 리포맷팅이 안됩니다. 아래는 강사님 강의하시는거 캡쳐한 이미지입니다.

  • flutter
  • 클론코딩
junyoung.yoon 댓글 1 좋아요 0 조회수 221

인기 태그

인프런 TOP Writers

주간 인기글