FunctionalData는 중첩된 데이터 구조에 액세스하고 수정하는 데 사용되는 함수형 프로그래밍 구성 요소인 렌즈를 생성하기 위한 어노테이션과 유틸리티 헬퍼를 제공하는 Dart 패키지입니다. `function_data_generator` 코드 생성기와 함께 작동하여 봐일러플레이트 없이 불변 데이터 클래스를 자동으로 생성하며 강력한 업데이트 기능을 제공합니다. 이 패키지는 변형 없이 깊이 중첩된 객체에 대해 안전하고 조합 가능한 업데이트를 가능하게 하여 Flutter 및 Dart 애플리케이션에서 함수형 프로그래밍 원칙을 촉진합니다. 상태 관리 및 데이터 변환 워크플로우에 이상적입니다.
사용 사례
불변 상태 업데이트
중첩된 데이터 조작
Flutter 앱에서의 상태 관리
함수형 프로그래밍 패턴
데이터 클래스를 위한 코드 생성
주요 기능
자동 렌즈 생성
불변성 지원
심층 중첩 업데이트
형 안전한 변환
코드 생성기와의 통합
적합한 대상
함수형 프로그래밍을 사용하는 개발자
복잡한 상태를 가진 Flutter 앱
불변성을 우선시하는 팀
코드 생성 워크플로
데이터 집약형 애플리케이션
고려 사항
`function_data_generator`가 필요합니다
렌즈를 위한 학습 곡선
제한된 런타임 반사
간단한 데이터 모델에 적합하지 않습니다
추가 빌드 단계 필요
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Functional Data
Simple and non-intrusive code generator for boilerplate of data types. The package generates a simple mixin with
operator==, hashCode, copyWith, toString, as well as lenses.
Boiler plate
Because the boiler plate is generated as a mixin, it is minimally intrusive on the interface of the class. You
only have to provide a constructor with named arguments for all fields and extend the generated mixin.
Because of this design, you have complete control over the class. You can, for example, add named constructors
or methods to the class like you're used to.
Lenses
For every class, lenses are generated for all fields which allow viewing a field or creating a new
instance of the classes with that field modified in some way. For example, the lens of Person's name is
Person$.name. To focus a lens on a specific instance use its of method:
This isn't very exciting yet. The power of lenses comes to light when you combine them. It allows you to easily
create a copy of a large nested data structure with one of the fields in a leaf modified. Two lenses can be chained
using then.
To specify which features should be generated for you whole project, create a file called functional_data_options.yaml
in the root of your project.
Class specific arguments will override the project level configuration.