본문 바로가기

Flutter-플러터

Flutter Getx Bindings을 쓰는 이유

반응형

Get x를 쓰면서 Bindings 를 많이 쓴다. 그래서 그 이유가 궁금해서 GPT에게 물어보았다. 

 

Get x는 위젯의 상태가 변화면 그 변화를 감지해야 한다. 그래서 그 과정을 좀더 효과적으로 제공하고자 많이들 쓴다. 

코드의 양이 줄어드는 것은 보너스 

 

 

Chat GPT 의 답변

 

 

In Flutter, when using the GetX state management package, bindings are used to provide data to a widget or screen before it is displayed. Bindings are essentially a way to pre-populate data that will be used by the widget or screen with data from a GetX controller. The purpose of using bindings in GetX is to make the widget or screen more efficient by preloading the data that it will use.

There are several benefits to using bindings when working with GetX in Flutter:

  1. Performance: By using bindings, you can preload data that will be used by a widget or screen, which can improve performance and reduce the amount of time it takes for the widget or screen to load.
  2. Organization: Bindings can help you organize your code by separating data loading logic from the widget or screen logic. This can make your code easier to read and maintain.
  3. Reusability: Bindings can be reused across multiple widgets or screens, which can save time and reduce the amount of duplicated code in your app.

Overall, using bindings with GetX in Flutter can help you create more efficient, organized, and reusable code.

 

 

728x90
반응형

'Flutter-플러터' 카테고리의 다른 글

Flutter - copywith  (0) 2023.03.19
flutter_quill 패키지  (0) 2023.03.17
Flutter : DefaultTabController - 탭바 만들기...!  (0) 2023.02.08
Flutter : FloatingAcionButtonLocation  (0) 2023.02.06
flutter datetime 변환작업  (0) 2023.01.29