data_class 0.0.1+1 copy "data_class: ^0.0.1+1" to clipboard
data_class: ^0.0.1+1 copied to clipboard

Experimental support for data classes in Dart using pkg:macros

example/main.dart

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
}
42
likes
0
pub points
75%
popularity

Publisher

verified publisherfelangel.dev

Experimental support for data classes in Dart using pkg:macros

Repository (GitHub)
View/report issues

Topics

#macros #data-class

License

unknown (license)

More

Packages that depend on data_class