728x90
반응형

Flutter/Package 25

[Flutter] Bloc ④ - context.read, context.watch, context.select

Bloc ① - 소개 https://dalgoodori.tistory.com/28 Bloc ② - Cubit 과 Bloc https://dalgoodori.tistory.com/29 Bloc ③ - Bloc Widgets https://dalgoodori.tistory.com/30 Bloc ④ - context.read, context.watch, context.select Bloc ⑤ - Bloc Test https://dalgoodori.tistory.com/32 1. context.read context.read()는 T 유형의 가장 가까운 조상 인스턴스를 찾습니다. 기능적으로 BlocProvider.of(context)와 동일합니다. context.read는 onPressed 콜백 내에 이벤트를 ..

Flutter/Package 2022.08.05

[Flutter] Bloc ③ - Bloc Widgets

Bloc ① - 소개 https://dalgoodori.tistory.com/28 Bloc ② - Cubit 과 Bloc https://dalgoodori.tistory.com/29 Bloc ③ - Bloc Widgets Bloc ④ - context.read, context.watch, context.select https://dalgoodori.tistory.com/31 Bloc ⑤ - Bloc Test https://dalgoodori.tistory.com/32 1. BlocBuilder 화면에서 가장 많이 쓰이는 위젯입니다. BlocProvider 로 create 해준 Bloc 이 있다면 context.read 로 불러올 수 있습니다. create 해준 Bloc 이 없다면 bloc 을 받아 사용하..

Flutter/Package 2022.08.04

[Flutter] Bloc ② - Cubit 과 Bloc

Bloc ① - 소개 https://dalgoodori.tistory.com/28 Bloc ② - Cubit 과 Bloc Bloc ③ - Bloc Widgets https://dalgoodori.tistory.com/30 Bloc ④ - context.read, context.watch, context.select https://dalgoodori.tistory.com/31 Bloc ⑤ - Bloc Test https://dalgoodori.tistory.com/32 Cubit Cubit 은 Bloc 과 다르게 이벤트 기반이 아니라 정말 간단하게 상태를 관리할 수 있습니다. Provider 의 ChangeNotifier 와 비슷합니다. 생성 Cubit 을 상속받는 클래스를 만들어주면 됩니다. 초기값은 내..

Flutter/Package 2022.08.04

[Flutter] Bloc ① - 소개

Bloc ① - 소개 Bloc ② - Cubit 과 Bloc https://dalgoodori.tistory.com/29 Bloc ③ - Bloc Widgets https://dalgoodori.tistory.com/30 Bloc ④ - context.read, context.watch, context.select https://dalgoodori.tistory.com/31 Bloc ⑤ - Bloc Test https://dalgoodori.tistory.com/32 Flutter에서는 UI 와 비즈니스 로직을 분리하기 위해서 많이 쓰이는 Bloc 에 대해서 포스팅 합니다. Provider 와 같이 관심사 분리를 위해 쓰이는 것은 동일하지만 Bloc 은 Provider 와 다르게 State와 Event를..

Flutter/Package 2022.08.03

[Flutter] Provider

옛날 JSP, PHP 코드를 보면 UI 와 비즈니스 로직이 섞여 수천줄이나 되는 코드를 볼 수 있었습니다. 이런 코드는 가독성은 두말할 것도 없지만 코드를 작성한 사람도 시간이 지나면 알아보기 힘들 정도이기 때문에 유지보수에 굉장히 애를 먹습니다. 한사람이 처리하던 많은 일을 여러 사람과 분업을 하듯이 UI 와 비스니스 로직을 떼어놓는 관심사 분리 작업이 필요합니다. Flutter 에서는 Provider 로 관심사 분리를 할 수 있습니다. provider | Flutter Package A wrapper around InheritedWidget to make them easier to use and more reusable. pub.dev 앱을 처음 만들었을 때 기본으로 제공되는 카운팅 앱으로 예시로 했..

Flutter/Package 2022.07.27

[Flutter] Hive

Flutter Local DB 중에서는 Sqlflite, Drift 처럼 RDBMS 만 있는게 아닌 NoSql 도 존재합니다. Nosql 형태인 Hive 에 대해서 간단하게 포스팅 하려고 합니다. hive | Dart Package Lightweight and blazing fast key-value database written in pure Dart. Strongly encrypted using AES-256. pub.dev pubspec.yaml dependencies: hive: ^2.2.3 hive_flutter: ^1.1.0 dev_dependencies: build_runner: ^2.2.0 hive_generator: ^1.1.3 hive_todo.dart HiveObject 를 상속 후 ..

Flutter/Package 2022.07.26

[Flutter] Drift

Flutter 에서 로컬 데이터베이스 패키지 중 하나인 Drift 에 대해서 포스팅합니다. Drift 는 Sqlflite 와 다르게 ORM 방식의 데이터베이스 입니다. ORM 은 Object Relational Mapping (객체-관계 매핑), 쉽게 말해서 객체와 관계형 데이터베이스의 데이터를 연결해주는 것을 말합니다. Android 의 Room , Spring 의 JPA, Node.js 의 Sequelize 등을 써보신 분은 익숙할 것입니다. drift | Dart Package Drift is a reactive library to store relational data in Dart and Flutter applications. pub.dev pubspec.yaml dependencies: dri..

Flutter/Package 2022.07.25

[Flutter] Sqlflite

Flutter 에서 로컬 데이터베이스 패키지 중 하나인 Sqlflite 에 대해서 포스팅합니다. 간단한 화면과 CRUD 를 구현해보려고 합니다. sqflite | Flutter Package Flutter plugin for SQLite, a self-contained, high-reliability, embedded, SQL database engine. pub.dev pubspec.yaml dependencies: sqflite: ^2.0.3 todo.dart 로컬DB 로 흔히 구현하는 Todo 로 만들어봤습니다. autoincrement 로 제약을 걸 예정인 id 는 nullable 로 두겠습니다. class Todo { String title; bool done; int? id; Todo({ re..

Flutter/Package 2022.07.24

[Flutter] Freezed

Freezed 는 data class 에서 필요한 기능들을 제공해주는 매우 유용한 라이브러리 입니다. freezed | Dart Package Code generation for immutable classes that has a simple syntax/API without compromising on the features. pub.dev pubspec.yaml dependencies: freezed_annotation: ^2.1.0 dev_dependencies: build_runner: ^2.2.0 freezed: ^2.1.0+1 json_serializable: ^6.3.1 Class 작성 import 'package:freezed_annotation/freezed_annotation.dart'..

Flutter/Package 2022.07.22
728x90
반응형