v0.1.2
data_class
pkg:macros를 사용한 Dart의 데이터 클래스에 대한 실험적 지원
60좋아요 5130일 다운로드50Pub 점수
플랫폼 정보 없음
매크로를 사용한 Dart의 데이터 클래스에 대한 실험적 지원.
아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
Support for data classes in Dart using macros.
🪨 const constructors with required, named parameters
🖨️ copyWith with optional, nullable, named parameters
✨ toString for an improved string representation
☯️ operator== and hashCode for value equality
import 'package:data_class/data_class.dart';
@Data()
class Person {
final String name;
}
void main() {
// 🪨 Create a const instance with required, name parameters.
const dash = Person(name: 'Dash');
// 🖨️ Create copies of your object.
final sparky = dash.copyWith(name: 'Sparky');
// ✨ Human-readable string representation.
print(dash); // Person(name: Dash)
print(sparky); // Person(name: Sparky)
// ☯️ Value equality comparisons.
print(dash == dash.copyWith()); // true
print(dash == sparky); // false
}
Add package:data_class to your pubspec.yaml
dependencies:
data_class: any
Enable experimental macros in analysis_options.yaml
analyzer:
enable-experiment:
- macros
Use the @Data annotation (see above example).
Run it
dart --enable-experiment=macros run main.dart
*Requires Dart SDK >= 3.5.0
의존성 목록 4 개
^1.0.0^3.0.0-dev^0.1.0-main.5^1.0.0사용 목적에 따라 검색하고 개발 활동을 비교한 뒤 원본 저장소에서 요구 사항을 확인하세요.
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗