Giter Club home page Giter Club logo

flutter_bloc_exam's Introduction

flutter_bloc_exam

1. Bloc이란?

Business Logic Component
플러터 애플리케이션에서 상태 관리 및 비즈니스 로직을 분리하고 관리하기 위한 디자인 패턴


2. Bloc의 핵심 아이디어

  1. 상태분리

    • 애플리케이션의 상태와 UI를 분리하여 관리합니다.
    • UI 렌더링 로직과 비즈니스 로직을 분리하여 코드관리를 용이하게 합니다.
  2. 이벤트 처리

    • 사용자 입력 또는 데이터 변경과 같은 이벤트를 처리합니다.
    • 이벤트는 bloc으로 전달되어 상태변화를 일으키며, 이에 따라 UI가 업데이트 됩니다.
  3. 상태 스트림

    • bloc은 Stream을 사용하여 애플리케이션의 상태를 갱신합니다.
    • 상태 스트림을 통해 UI는 bloc의 상태를 구독하고, 상태가 업데이트 될때마다 UI가 갱신됩니다.
  4. 단일 책임 원칙

    • 각 bloc은 특정 부분의 비즈니스 로직과 상태를 관리합니다.
    • 더 작은 단위로 분할하고 모듈화하여 관리할 수 있습니다.

3. Bloc의 구성 요소

  1. bloc

    • 비즈니스 로직과 상태를 관리하는 클래스
    • 이벤트를 입력받아 상태를 변화시키며, UI에 상태를 제공하는 스트림을 제공합니다.
  2. 이벤트

    • 사용자 입력 또는 데이터 변경과 같은 액션을 나타내는 클래스
    • bloc으로 전달되어 상태 변경을 유발합니다.
  3. UI

    • 사용자 인터페이스를 구성하는 위젯입니다.
    • UI는 bloc의 상태를 구독하여 상태에 따라 UI를 업데이트 합니다.

4. 패키지 추가하기

flutter pub add flutter_bloc // 명령어를 터미널에 입력하여 라이브러리 패키지를 추가합니다.
flutter pub add bloc

OR

dependencies:
  flutter:
    sdk: flutter
  flutter_bloc: ^8.1.5

flutter_bloc_exam's People

Contributors

de-quei avatar

Stargazers

hyunjoon park avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.